I have a table in mysql database with auto increments PRIMARY KEY. On a regular basis, rows in this table are deleted by appending. Thus, the PK result of the last row grows very fast, but there are not many rows in this table.
What I want to do is “recount” PK so that the first line has PK = 1, the second line PK = 2, and so on. There are no external dependencies on PK of this table, therefore it will be "safe".
Can this be done using only mysql queries / tools? Or should I do this from my code?
source
share