Why God why?!!?!
4 years ago
How asinine is this?!? The best part is
“The auto-increment counter is stored only in main memory, not on disk.“
Let’s see how this lets us have fun.
- Create a table with an auto-increment key
- Insert two entries into said table
- Delete entry with greatest key; note key value
- Stop MySQL
- Start MySQL
- Insert a single entry into our favorite table
The newly inserted key value will be equal to the deleted key value. Wait, what? Another way to have fun with this is
- Create a table with an auto-increment key
- Insert a single entry into our favorite table; note key value
- Delete entry (using where id =); table should be empty
- Stop MySQL
- Start MySQL
- Insert a single entry into our favorite table
The newly inserted key value will be 1, regardless of the deleted key value. Why bother having auto_increment functionality if it always wants to reset itself?

