CS-Base icon indicating copy to clipboard operation
CS-Base copied to clipboard

非唯一索引在数据加锁时,在使用「小于等于」条件且「查询条件不存在」的情况下,next-key lock为什么也不会退化到间隙锁?

Open Zison-Yung opened this issue 2 years ago • 1 comments

image 我觉得这种情况下,最后一个范围记录的next-key lock退化到间隙锁,好像也没有问题。但是经过测试,确实没有退化,这是什么原因呢?

image

image

image

Zison-Yung avatar Jul 16 '23 06:07 Zison-Yung

是的, 退化后是没问题,是一个可以优化的点,目前 mysql 的做法是没有进行优化,原因就是没有做优化,没什么特别的原因。

xiaolincoder avatar Aug 08 '23 04:08 xiaolincoder