What is the biggest ID number that autoincrement can produce in mysql

user123_456 picture user123_456 · May 22, 2012 · Viewed 38.3k times · Source

I have an database that is rapidly filled with data we talk about 10-20k rows per day.

What is a limit of an ID with and autoincrement option? If ID is created as INTEGER then I can do max value of 2,147,483,647 for unsigned values?

But what when autoincrement goes above this? Does it all collapses? What would be solution then?

I am sure that a lot of people have big databases, and I would like to hear them.

Thank you.

Answer

Dan Armstrong picture Dan Armstrong · May 22, 2012

If you are worried about it growing out of bounds too quickly, I would set the PK as an UNSIGNED BIGINT. That gives you a max value of 18446744073709551615, which should be sufficient.