John Tsangaris wrote:
> 
> If I turn on auto increment and let it do it's thing and then later on
> delete a few of the entries (let's say 1, 2, 3) and the current high entry
> has an id of 45.. why does mysql continue with 46 instead of using up 1, 2,
> and 3 first?  Is there a way to bypass this?
> 
> John


To avoid duplication of those keys in many cases.  For example if you
archived 1,2,3 and removed them from the table you may want to add them back
in and you don't want their ID's to be taken.  Or you may have references
to 1,2,3 in other tables, if you delete them it would be wrong
for the references to point to the new 1,2,3. Of course you should probably
delete the references but if you didn't it would be confusing that
you had pointers to the wrong lines.

The point is that auto_increment generates UNIQUE values, and those
values should be unique for the life of the table, not pending deletes.

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to