Tagged articles
4 articles
Page 1 of 1
New Oriental Technology
New Oriental Technology
Jun 13, 2024 · Databases

Understanding InnoDB Row-Level Locks and Locking Rules in MySQL

This article explains the types of InnoDB row‑level locks—record lock, gap lock, and next‑key lock—describes how MySQL determines lock ranges based on indexing, outlines the two fundamental locking principles with associated optimizations, and provides concrete examples for primary‑key and ordinary indexes.

Gap LockInnoDBNext-key Lock
0 likes · 11 min read
Understanding InnoDB Row-Level Locks and Locking Rules in MySQL
ITPUB
ITPUB
Feb 8, 2023 · Databases

Why Does One MySQL UPDATE Block While Another Doesn’t? A Deep Dive into Row‑Level Locks

This article explains why an UPDATE on a MySQL row that changes a regular column proceeds without blocking, while an UPDATE that modifies the primary‑key value gets blocked, by analyzing the locks set by preceding transactions, the B+‑tree index structure, and the delete‑plus‑insert rewrite performed by InnoDB.

B+TreeGap LockNext-key Lock
0 likes · 9 min read
Why Does One MySQL UPDATE Block While Another Doesn’t? A Deep Dive into Row‑Level Locks