Why mysql after the transaction is rolled back, still increment increment ID

Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/weixin_44018338/article/details/102525526

Because the current value of the counter record auto_increament of innodb is stored in memory in the memory, it does not exist on disk, when mysql
when the server is running, the count value of the change will only increase as the insert, delete and will not end with cut back. And when mysql
when the server is started, when we need to make inquiries auto_increment count value, mysql will automatically execute: SELECT MAX (id) FROM table
FOR UPDATE; statement to obtain the maximum value of the current auto_increment column, then this value into auto_increment counter. So even if
Rollback MySQL is not as negative auto_increament counter operation.

Guess you like

Origin blog.csdn.net/weixin_44018338/article/details/102525526