Re: Overcoming limits of Auto_Increment
Posted by:
Rick James
Date: October 03, 2014 07:01PM
* The next value assigned to an AUTO_INCREMENT column will be bigger than all existing values.
* Holes are not reused.
* There is one obscure case where where you can DELETE the max value, it will be reused.
* The values will not loop back to 1 (or 0).
* In the case if TINYINT UNSIGNED, it will eventually insert 255. Subsequent inserts will continue to try to insert 255 and get an error (duplicate key).
* A number _can_ be reused, but only if you explicitly specify the number in the INSERT. This is _not_ normally done. (It defeats the purpose of AUTO_INCREMENT.)
Suggest
ALTER TABLE table_name MODIFY id SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT;
That will change your limit from 255 to 65535.
Subject
Written By
Posted
Re: Overcoming limits of Auto_Increment
October 03, 2014 07:01PM
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.