Question

I have a MySql 5.1.52 database with a table which has consistently forgotten its autonumber sequence and then subsequently started from 1 again. It can take hours, days or weeks for this reset to occur.

Some have suggested that its related to clearing the table, that being empty it is unable to maintain its autonumber. Performing a few tests of my own to prove this theory failed. The table remembers its autonumber sequence even when cleared of all rows.

Do you know why this could be happening ?

Was it helpful?

Solution

InnoDB tables reset their autoincrement to MAX(auto_inc_column)+1 when the server starts. If the table is empty it resets to 1.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top