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”.
有什么区别吗
1条答案
按热度按时间dfuffjeb1#
没有区别。无论索引是显式索引、主键索引还是隐藏聚集索引,记录锁的行为方式都相同。