mysql锁_31天
10 11 13 20
<=13 for update
-> 10 11 13 20
x x x x 聚集索引,不加gap索引
1 1 3 6 8 b=3
二级所以加gap锁 6加gap
insert intention 特殊的gap锁
这里40对50加insertion intention锁,40也有锁,隐式锁
pager less
select * from c; 就一列数据,有主键
10 11 13 20 25
delete from a <=20;
插入18,会去找13 20加锁了 所以等待
但是18插入之后 会有insertion intention锁

rr隔离级别下 一个表没有创建索引
delete from d where a=20 所有记录都加锁
rc隔离级别 只对满足条件的记录加锁
如果a有普通索引 rc隔离级别下二级索引加记录锁 对应的聚集索引加锁
rr级别呢?
innodb锁的算法:
禁用next-key locking
read-committed
innodb_locks_unsafe_for_binlog
row-based binlog
rc性能并没有rr好
rc隔离级别 加记录锁(rc隔离也有gap锁)

插入8,6允许 插入6,6 不允许

二级索引带key值


事务列表


非锁定读 隔离级别小于rr ,读不会被阻塞


浙公网安备 33010602011771号