Should auto-increment value be occasionally reset on primary keys?

Once a primary key has a number that is over 9 million, is there wisdom in resetting this number back to zero? In other words, does a primary key that has a number that large begin to cause some performance issues?


9 million? a piffle, sir!

presumably you are storing this number in an INTEGER datatype, yes?

Correct, the number is stored as an unsigned integer.

Then according to the documentation, in terms of
PK fields, you can have up to 4294967295 and be good to go

and we can assure you, if you don’t learn about sharding ~long~ before you get to a billion rows, the size of the number will be the least of your worries

1 Like

I think no one has answered your actual question. I am not an expert but I doubt that the value makes much difference. It is the number of records that exist for each of the values. If most of the records do not exist then performance would be the same as if the primary key value was consistent with the number of records. Databases don’t reserve space for values that don’t exist.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.