Tag

next-key lock

0 views collected around this technical thread.

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 LockInnoDBMySQL
0 likes · 11 min read
Understanding InnoDB Row-Level Locks and Locking Rules in MySQL
政采云技术
政采云技术
Feb 23, 2023 · Databases

Understanding Next-Key Lock Deadlocks in MySQL: Analysis and Solutions

This article examines how common business operations using SELECT ... FOR UPDATE and INSERT can cause MySQL Next‑Key lock deadlocks, explains the underlying gap‑lock and row‑lock mechanisms, demonstrates practical experiments, and proposes strategies such as postponing locks or using primary‑key updates to avoid such deadlocks.

DatabaseMySQLSQL
0 likes · 14 min read
Understanding Next-Key Lock Deadlocks in MySQL: Analysis and Solutions
政采云技术
政采云技术
Feb 21, 2023 · Databases

Understanding Next-Key Lock Deadlocks in MySQL and How to Avoid Them

This article examines how common business operations using SELECT ... FOR UPDATE and INSERT can cause Next‑Key lock deadlocks in MySQL under repeatable‑read isolation, demonstrates the locking behavior with practical SQL examples, and proposes strategies such as post‑locking and primary‑key updates to prevent such deadlocks.

DatabaseIsolation LevelMySQL
0 likes · 14 min read
Understanding Next-Key Lock Deadlocks in MySQL and How to Avoid Them
政采云技术
政采云技术
Jul 28, 2022 · Databases

Analyzing and Resolving MySQL Next‑Key Lock Deadlocks: A Practical Case Study

This article walks through a real MySQL deadlock scenario, explaining the four necessary deadlock conditions, illustrating how Next‑Key locks on non‑unique indexes cause gap locks, and presenting step‑by‑step analysis, experimental verification, and practical recommendations to avoid such deadlocks in production systems.

DatabaseMySQLSQL
0 likes · 15 min read
Analyzing and Resolving MySQL Next‑Key Lock Deadlocks: A Practical Case Study
Selected Java Interview Questions
Selected Java Interview Questions
Sep 27, 2020 · Databases

Understanding How MySQL InnoDB Solves Phantom Reads

This article explains the four transaction isolation levels, defines phantom reads, and details how MySQL's InnoDB engine uses MVCC snapshot reads and next‑key locking (including the next‑key principle and lock composition) to prevent phantom reads under the REPEATABLE READ isolation level.

InnoDBIsolation LevelMVCC
0 likes · 2 min read
Understanding How MySQL InnoDB Solves Phantom Reads
Selected Java Interview Questions
Selected Java Interview Questions
Sep 17, 2020 · Databases

Understanding MySQL Gap Locks and Next‑Key Locks with Practical Examples

This article explains how InnoDB implements row locks, gap locks, and next‑key locks to prevent phantom reads, describes how the lock ranges are determined, and demonstrates their effects through multiple transaction scenarios with detailed SQL code examples.

Gap LockInnoDBMySQL
0 likes · 11 min read
Understanding MySQL Gap Locks and Next‑Key Locks with Practical Examples