MySQL table with AUTO_INCREMENT primary id does not release the number after a rollback

谁说我不能喝 提交于 2019-12-02 05:34:05

For concurrency reasons, the auto increment value cannot "rollback" with your transaction. If another process had inserted records while your transaction was in process, you'd risk a collision with their IDs later.

As an example, let's say your transaction in process "A" grabs IDs 1,2 and 3. Another process "B" runs and gets IDs 4 and 5. If the identity rolled back with your transaction and the next process "C" needed 5 IDs, it would get 1,2,3,4,5 but 4 and 5 were already taken by process "B".

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!