List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:May 22 1999 1:08pm
Subject:Re: auto_increment after deleting last ID
View as plain text  
At 10:14 PM +0200 5/21/1999, Davor Cengija wrote:
>       hi.
>
>       i'm still very new to mysql, so if such a question is already
>       answered somewhere, URL would be just fine.
>
>       i have a table with auto_increment field (and lets say 20
>       rows). if i delete row 10, and then insert a new row, it gets
>       id=21 which is ok. but if i delete the row the the highest id
>       value (here 21) and then insert a new on, it gets id=21.
>
>       should'n it be 22?


No.  The new id is always one more than the largest id currently in
the table.  If you delete all the rows, the sequence will start over
at 1.

This behavior will change when 3.23.x comes out, when you'll be able
to get strictly increasing sequences with no reuse.

--
Paul DuBois, paul@stripped
Northern League Chronicles: http://www.snake.net/nl/
Thread
auto_increment after deleting last IDDavor Cengija22 May
  • Re: auto_increment after deleting last IDPaul DuBois22 May
    • Re: auto_increment after deleting last IDDavor Cengija22 May