4

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 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

Community
  • 1
  • 1
user291701
  • 38,411
  • 72
  • 187
  • 285
  • 4
    exact duplicate of [this](http://stackoverflow.com/questions/2615417/what-happens-when-auto-increment-on-integer-column-reaches-the-max-value-in-datab) – eykanal Feb 15 '11 at 21:30
  • @eykanal when posting duplicates I think it's most helpful to use the full like or link the title of the question – Matthew Feb 15 '11 at 21:47
  • in response to Matthew - duplicate of "[What happens when auto_increment on integer column reaches the max_value in databases?](http://stackoverflow.com/questions/2615417/what-happens-when-auto-increment-on-integer-column-reaches-the-max-value-in-datab)" – eykanal Feb 15 '11 at 21:51

1 Answers1

0

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).

Dan J
  • 16,319
  • 7
  • 50
  • 82
Michael Goldshteyn
  • 71,784
  • 24
  • 131
  • 181