官术网_书友最值得收藏!

  • 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.

主站蜘蛛池模板: 武宣县| 富平县| 清河县| 克什克腾旗| 汤阴县| 广丰县| 屏南县| 城市| 肥乡县| 荣成市| 虎林市| 安阳市| 浦北县| 乌拉特中旗| 潍坊市| 巴马| 高州市| 丰原市| 基隆市| 柞水县| 嵊泗县| 通许县| 上杭县| 双牌县| 疏附县| 商城县| 体育| 永胜县| 丰镇市| 镇巴县| 老河口市| 澄迈县| 大关县| 黎城县| 柞水县| 晋城| 鄂托克前旗| 探索| 年辖:市辖区| 南通市| 安乡县|