We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
包含了两个“原则”、两个“优化”和一个“bug”
next-key lock
lock in share mode
for update
The text was updated successfully, but these errors were encountered:
git-zjx
No branches or pull requests
加锁规则
包含了两个“原则”、两个“优化”和一个“bug”
next-key lock
。希望你还记得,next-key lock
是前开后闭区间。next-key lock
退化为行锁。next-key lock
退化为间隙锁。注意事项
lock in share mode
只锁覆盖索引,执行for update
时,系统会认为你接下来要更新数据,因此会顺便给主键索引上满足条件的行加上行锁lock in share mode
来给行加读锁避免数据被更新的话,就必须得绕过覆盖索引的优化,在查询字段中加入索引中不存在的字段next-key lock
执行的时候,是要分成间隙锁和行锁两段来执行的The text was updated successfully, but these errors were encountered: