MySQL Forums
Forum List  »  General

Re: What happens when Auto Increment runs out of values
Posted by: Rick James
Date: October 13, 2013 12:34AM

AUTO_INCREMENT always gives you a value bigger then any existing value.
Two exceptions:
* When you do ALTER TABLE...AUTO_INCREMENT=... -- this might let you land in the middle. Don't do it; it is too ugly to discuss.
* If you DELETE the highest values in the table, then restart the server, you can reuse those values -- This is because, during startup, MySQL does (effectively) SELECT MAX(id)+1 to find out what value to use next. Restarting is also ugly.

You can do an ALTER TABLE to change the datatype from TINYINT UNSIGNED to MEDIUMINT UNSIGNED. That will give you lots more values.

Options: ReplyQuote


Subject
Written By
Posted
Re: What happens when Auto Increment runs out of values
October 13, 2013 12:34AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.