当前位置:网站首页>MySQL中update一条record的过程
MySQL中update一条record的过程
2022-06-29 09:26:00 【一缕阳光a】
在MySQL中,update是原地更新数据,原地更新数据,原地更新数据。重要的事情说3遍。这是不同于PGSQL的。
update的具体过程是:
(1)、先对该条record对应的索引加X锁
(2)、将修改后的数据写入到redo.log中
(3)、将修改之前的数据备份到undo.log中
(4)、备份完毕,原地更新数据,修改txid,将roll_ptr指向undo.log中该条记录的备份,最后提交事务tx
(5)、提交事务tx过程中,服务器突然宕机,再次重启时,重放redo.log中的日志进行数据的修复。
如果在还未提交tx之前服务器突然宕机了,但是对应的dirty page已经flush到磁盘文件中,那么再次启机时,可以根据undo.log中的日志进行数据的恢复
边栏推荐
猜你喜欢
随机推荐
2019.11.17 training summary
十六制计数器和流水灯
1099 Build A Binary Search Tree (30 分)
Setinterval, setTimeout and requestanimationframe
mysql 8.0 一条insert语句的具体执行流程分析(二)
manacher
Codeforces Round #641 Div2
We can't tell the difference between distributed and cluster. Let's tell the story of two cooks cooking
Wandering -- the last programming challenge
2019.10.30 learning summary
蛇形填数
Memory layout of JVM objects
Codeforces Round #645 (Div. 2)
走迷宫 bfs 中等+——最后的编程挑战
基辅周边的凄美废墟——切尔诺贝利的安全前往指南!
弧形 View 和弧形 ViewPager
Nacos环境隔离
山科 的C语言2018练习题(电信)
1146 Topological Order (25 分)
CodeForces - 1151B 思维








