List:General Discussion« Previous MessageNext Message »
From:D Campbell Date:October 28 2001 3:02am
Subject:can auto_increment wrap?
View as plain text  
quickie:  can auto_increment wrap?

I have a system that uses mysql for temporary storage of
data.  The records are kept unique in the usual lazy man's
way of having an auto_increment ID field.

A large number of records come and go from this database.

At SOME point in the future, the integer value of auto_increment
will exceed that which can be carried by the largest unsigned 
integer data type available.

Is there a way to modify the auto_increment "extra" on the
field to allow it to wrap around, keeping it from exceeding
the maximum encodable value and thereby keeping inserts 
from failing on a non-unique primary key error?

Assuming record 1 (why not zero?) has already been deleted
when mysqld tries to write record MAXINT+1, would it not be
natural to re-use the sequence?

The only kludge I've found around this is to, at some point,
delete everything from the table.


dcampbel - duncan campbell

Do You Yahoo!?
Make a great connection at Yahoo! Personals.
can auto_increment wrap?D Campbell28 Oct
  • RE: can auto_increment wrap?Chris Bolt28 Oct
    • Re: can auto_increment wrap?David Felio29 Oct
      • RE: can auto_increment wrap?Chris Bolt29 Oct
      • RE: can auto_increment wrap?Carsten H. Pedersen29 Oct
  • Re: can auto_increment wrap?Dan Nelson28 Oct