Aikesheng Open Source Community
Aikesheng Open Source Community
Sep 10, 2025 · Databases

Why SELECT … FOR UPDATE Still Reads the Primary Key: MySQL Index Scan Deep Dive

This article examines why a SELECT … FOR UPDATE query that appears to use a covering index in MySQL actually performs a table‑row lookup, detailing indirect evidence from performance_schema locks and direct proof through InnoDB source code, and explains the necessity of accessing the primary key for transaction isolation.

Database InternalsIndex ScanInnoDB
0 likes · 9 min read
Why SELECT … FOR UPDATE Still Reads the Primary Key: MySQL Index Scan Deep Dive
dbaplus Community
dbaplus Community
Jul 16, 2023 · Databases

How Do MySQL Locks Cause Deadlocks? Real‑World Cases and Solutions

This article explains MySQL deadlocks through practical examples, covering lock types, exclusive vs. shared locks, lock‑in‑share‑mode vs. FOR UPDATE differences, real‑world deadlock scenarios, and multiple strategies—including isolation level tweaks, optimistic locking, and distributed locks—to prevent and resolve them.

LockMySQLfor update
0 likes · 19 min read
How Do MySQL Locks Cause Deadlocks? Real‑World Cases and Solutions