Possible Duplicate:
What happens when auto_increment on integer column reaches the max_value in databases?
Hi,
I have a mysql database, and a table which stores gamerooms for a multiplayer game. I have an integer priamry key auto increment setup for the开发者_StackOverflow中文版 game ids. So each time a new game is hosted, it just gets the next integer id as its game id. When I game is over, I remove the record from the table. I'm wondering what happens if I ever get to max_int games created - will mysql spin back around to index 0 for the next game record that gets created?:
id (int, primary, auto-inc)
--------------------------
255
256
...
...
4,294,967,296
what happens on next insert?
Honestly I'm not going to get to 4,294,967,296 games, just curious as to what happens. Again, I'm removing completed games from the table, so in theory I would never have more than max_int records in there at any time, but I could spin up to that counter value over time.
Thanks
In some older versions of MySQL (e.g., 5.1.31) MySQL crashes. Nowdays a "generic autoincrement failure (ERR 1467)" is reported (same link, resolution).
精彩评论