Tagged articles

Table Lock

23 articles · Page 1 of 1
liandk
liandk
Aug 2, 2026 · Databases

Why Transaction Timeouts and Deadlocks Occur: Master MySQL Row, Table, Gap Locks

This article breaks down MySQL’s locking mechanisms—table, row, and gap locks—explaining their principles, performance trade‑offs, when they are triggered, how they relate to index usage, and provides practical deadlock avoidance techniques and a concise cheat‑sheet for common concurrency problems.

DeadlockGap LockLocks
0 likes · 7 min read
Why Transaction Timeouts and Deadlocks Occur: Master MySQL Row, Table, Gap Locks
ITPUB
ITPUB
Feb 24, 2026 · Databases

Why INSERT … SELECT Can Lock Your Table and How an Index Saves the Day

A real‑world MySQL incident shows that using INSERT … SELECT without proper indexing can cause full‑table scans and progressive row locks, leading to massive payment failures, but adding an index on the filter column prevents the lock and restores safe batch migration.

INSERT SELECTIndexMySQL
0 likes · 8 min read
Why INSERT … SELECT Can Lock Your Table and How an Index Saves the Day
Practical DevOps Architecture
Practical DevOps Architecture
May 29, 2025 · Databases

Quick Solutions for MySQL Table Locks

This guide outlines a step‑by‑step method to diagnose and release MySQL table locks by checking open tables, inspecting running processes, querying InnoDB transaction and lock tables, and generating KILL statements to terminate blocking sessions.

Database AdministrationMySQLSQL
0 likes · 3 min read
Quick Solutions for MySQL Table Locks
Aikesheng Open Source Community
Aikesheng Open Source Community
Aug 14, 2024 · Databases

Granting Table Locks and Row Locks in InnoDB

This article explains how InnoDB in MySQL 8.0.32 grants table and row locks, detailing the active versus passive acquisition, the lock‑granting algorithms for tables and rows, and the priority, weight, and FIFO rules that determine lock ordering and deadlock handling.

Database ConcurrencyInnoDBMySQL
0 likes · 11 min read
Granting Table Locks and Row Locks in InnoDB
LouZai
LouZai
Nov 6, 2023 · Databases

Understanding SELECT … FOR UPDATE: Table, Row, and Gap Locks in MySQL

This article sets up a MySQL 5.7 environment, runs a series of SELECT FOR UPDATE queries on primary keys, unique indexes, normal indexes, range scans and non‑indexed columns, then analyzes the resulting lock types—row, gap, next‑key and table locks—and distills practical locking rules.

Gap LockInnoDBMySQL
0 likes · 13 min read
Understanding SELECT … FOR UPDATE: Table, Row, and Gap Locks in MySQL
ITPUB
ITPUB
Oct 25, 2023 · Databases

SELECT FOR UPDATE: When MySQL Locks Rows vs. Tables – 20 Tested Scenarios

This article systematically investigates how MySQL's SELECT FOR UPDATE behaves under different versions (5.7 and 8.0) and isolation levels (RR and RC), covering twenty scenarios that vary by index type and query range, and summarizes whether the statement acquires row‑level, gap, or table‑level locks.

MySQLRow LockSELECT FOR UPDATE
0 likes · 21 min read
SELECT FOR UPDATE: When MySQL Locks Rows vs. Tables – 20 Tested Scenarios
Liangxu Linux
Liangxu Linux
Oct 7, 2022 · Databases

Why MyISAM’s Table Locks Can Outperform InnoDB in High‑Concurrency Scenarios

This article provides a systematic deep‑dive into MySQL table‑lock mechanics, comparing storage engines, explaining the advantages of table locks, detailing lock acquisition and release rules, showing how to monitor lock statistics, and revealing why MyISAM can deliver superior performance for heavy concurrent insert and select workloads despite using only table‑level locking.

Database PerformanceLock MechanismMyISAM
0 likes · 7 min read
Why MyISAM’s Table Locks Can Outperform InnoDB in High‑Concurrency Scenarios
Java Backend Technology
Java Backend Technology
Sep 20, 2022 · Databases

Does SELECT FOR UPDATE Lock Rows or the Whole Table in MySQL?

This article explains how MySQL's SELECT … FOR UPDATE adds a pessimistic lock, and demonstrates that using an indexed column or primary key results in a row lock, while lacking an index causes a table lock, with step‑by‑step verification using multiple transaction examples.

MySQLRow LockSELECT FOR UPDATE
0 likes · 4 min read
Does SELECT FOR UPDATE Lock Rows or the Whole Table in MySQL?
Top Architect
Top Architect
Nov 3, 2021 · Databases

Understanding SELECT ... FOR UPDATE Locking in MySQL: Row vs. Table Locks

This article explains how MySQL's SELECT ... FOR UPDATE statement adds a pessimistic lock, detailing when it results in row-level locking versus table-level locking based on the presence of indexes or primary keys, and demonstrates the behavior with multiple practical examples.

MySQLRow LockSELECT FOR UPDATE
0 likes · 5 min read
Understanding SELECT ... FOR UPDATE Locking in MySQL: Row vs. Table Locks
Aikesheng Open Source Community
Aikesheng Open Source Community
Jun 8, 2021 · Databases

Understanding Table Locks in MySQL When Using INSERT INTO SELECT and the Impact of Isolation Levels

The article explains why an INSERT INTO SELECT statement can lock an entire InnoDB table in MySQL, demonstrates the lock behavior with transaction examples, and offers two solutions—adding an index on the filtered column and adjusting the transaction isolation level—to avoid table‑wide blocking.

INSERT SELECTIndexInnoDB
0 likes · 13 min read
Understanding Table Locks in MySQL When Using INSERT INTO SELECT and the Impact of Isolation Levels
macrozheng
macrozheng
May 9, 2020 · Databases

Why Insert‑Into‑Select Can Lock Your MySQL Tables and How to Fix It

An engineer’s mishap with a massive ‘INSERT INTO … SELECT’ migration exposed how full‑table scans lock MySQL tables, causing payment failures, and shows that adding an index on the filter column prevents the lock and ensures safe, efficient data transfer.

Database MigrationINSERT INTO SELECTIndex
0 likes · 7 min read
Why Insert‑Into‑Select Can Lock Your MySQL Tables and How to Fix It
Programmer DD
Programmer DD
Apr 26, 2020 · Databases

Understanding MySQL Table and Row Locks: Mechanisms, Modes, and Types

This article explains the differences between MySQL table locks and row locks, how they are implemented by the server and storage engines, the lock modes and types (including intention, auto‑increment, gap, next‑key, and insert‑intention locks), and provides practical SQL examples with diagrams.

Gap LockInnoDBMySQL
0 likes · 13 min read
Understanding MySQL Table and Row Locks: Mechanisms, Modes, and Types