user19551894
user19551894

Reputation:

row-level locks vs index record locks

https://dev.mysql.com/doc/refman/8.0/en/innodb-locking.html#innodb-record-locks

Record Locks

A record lock is a lock on an index record. For example, SELECT c1 FROM t WHERE c1 = 10 FOR UPDATE; prevents any other transaction from inserting, updating, or deleting rows where the value of t.c1 is 10.

Record locks always lock index 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”.

¿what's the difference?

Upvotes: 1

Views: 570

Answers (1)

danblack
danblack

Reputation: 14736

There is no difference. Whether an index is explicit, a primary key, or hidden clustered, the record locks behave the same way.

Upvotes: 1

Related Questions