Category: MySQLDevelopment

MySQL Internals Locking Overview

Contents

[edit] Introduction: Concurrency and isolation control facilities in MySQL

[edit] Life cycle of a table during statement execution

A typical execution flow for a Data Manipulation Language (DML) statement:

There is no typical execution scheme for DDL statements.

[edit] Acquiring meta-data locks


[edit] The table cache

[edit] The table cache: internal structure
[edit] The table cache: operations
[edit] The table cache: locking multiple tables
[edit] Infamous LOCK_open problem

LOCK_open mutex:

It is one of the major MySQL concurrency bottlenecks. Please do not use this mutex!

[edit] Interesting example: ALTER TABLE

A simplified scheme of ALTER TABLE execution

This is a general case, there are optimized cases.

[edit] A debug trace for ALTER TABLE

Simplified debug trace for ALTER table

[edit] Another example: RENAME TABLE

(i.e. insert special TABLE placeholders into the table cache and wait until all instances of these tables are closed)

Note that we hold LOCK_open during the whole second phase!

Simplified debug trace for RENAME TABLE

[edit] Table level locks

[edit] A few words about pre-locking

[edit] Global read lock

Retrieved from "http://forge.mysql.com/wiki/MySQL_Internals_Locking_Overview"

This page has been accessed 1,393 times. This page was last modified 14:43, 14 February 2008.

Find

Browse
MySQLForge
Main Page
Current events
Recent changes
Random page
Help
Edit
Edit this page
Editing help
This page
Discuss this page
Post a comment
Printable version
Context
Page history
What links here
Related changes
My pages
Special pages
New pages
File list
Statistics
Bug reports
More...