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

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

主站蜘蛛池模板: 福鼎市| 沈丘县| 本溪| 济阳县| 宁阳县| 宜黄县| 康平县| 报价| 全州县| 闸北区| 高雄县| 海南省| 鞍山市| 确山县| 吉木乃县| 阳新县| 安岳县| 泗洪县| 宣汉县| 融水| 确山县| 富顺县| 门源| 莆田市| 田林县| 湘阴县| 嘉黎县| 特克斯县| 天津市| 河西区| 三都| 广西| 桦甸市| 孟连| 称多县| 聂拉木县| 定西市| 凤山市| 天等县| 黑山县| 奎屯市|