What happens when an integer overflow for a primary key with auto-increment?

Possible duplicate:
What happens when auto_increment on an integer column reaches max_value in databases?

Hello,

I have a mysql database and a table that stores slot machines for multiplayer games. I have an automatic increment setting for integers for game identifiers. Therefore, every time a new game is hosted, it simply receives the next integer identifier as the identifier of the game. When I finished the game, I delete the entry from the table. I am wondering what will happen if I ever get to the created max_int games - will mysql go back to index 0 for the next game entry to be created ?:

id (int, primary, auto-inc) -------------------------- 255 256 ... ... 4,294,967,296 what happens on next insert? 

Honestly, I'm not going to play 4,294,967,296 games, just curious what is happening. Again, I delete the completed games from the table, so theoretically I would never have more than max_int entries there at any time, but I could return to that counter value over time.

thanks

+4
source share

Source: https://habr.com/ru/post/1339899/


All Articles