- MySQL 8 for Big Data
- Shabbir Challawala Jaydip Lakhatariya Chintan Mehta Kandarp Patel
- 241字
- 2021-08-20 10:06:04
InnoDB auto increment
MySQL 8 has changed the auto-increment counter value store mechanism. Previously, it was stored in the memory, which was quite difficult to manage during server restarts or server crashes. However, now the auto-increment counter value is written into the redo log whenever the value gets changed and, on each checkpoint, it will be saved in the system table, which makes it persistent across the server restart.
With the previous version, updating the auto-increment value may have caused duplicate entry errors. Suppose if you updated the value of auto-increment in the middle of the sequence with a larger than the current maximum value, then but subsequent insert operations could not identify the unused values, which could cause a duplicate entry issue. This has been prevented by persisting the auto-increment value, hence subsequent insert operations can get the new value and allocate it properly.
If server restart happened, the auto-increment value was lost with the previous version as it was stored in memory and InnoDB needed to execute a query to find out the maximum used value. This has been changed, as the newer version has the capability to persist its value across the server restart. During the server restart, InnoDB initializes the counter value in memory using the maximum value stored in the data dictionary table. In case of server crashes, InnoDB initializes the auto-increment counter value that is bigger than the data dictionary table and the redo log.
- Implementing VMware Horizon 7(Second Edition)
- C語言程序設計基礎與實驗指導
- 認識編程:以Python語言講透編程的本質
- Learning Linux Binary Analysis
- Raspberry Pi 2 Server Essentials
- Learning ELK Stack
- C#程序設計
- VMware虛擬化技術
- Mastering JavaScript High Performance
- Windows內核編程
- Java語言程序設計教程
- Python+Tableau數據可視化之美
- Spring+Spring MVC+MyBatis從零開始學
- HTML5+CSS3+jQuery Mobile APP與移動網站設計從入門到精通
- OpenCV 3 Blueprints