mysql 行级锁与索引记录锁

toe95027  于 2023-01-01  发布在  Mysql
关注(0)|答案(1)|浏览(132)

https://dev.mysql.com/doc/refman/8.0/en/innodb-locking.html#innodb-record-locks
记录锁
记录锁是对索引记录的锁。例如,SELECT c1 FROM t WHERE c1 = 10 FOR UPDATE;防止任何其他事务插入、更新或删除t.c1值为10的行。
Record locks always lockindex records, even if a table is defined with no indexes. For such cases, InnoDB creates a hidden clustered index and uses this index for record locking. See Section 15.6.2.1, “Clustered and Secondary Indexes”.
有什么区别吗

dfuffjeb

dfuffjeb1#

没有区别。无论索引是显式索引、主键索引还是隐藏聚集索引,记录锁的行为方式都相同。

相关问题