Information Schema INNODB_LOCKS Table

The Information Schema INNODB_LOCKS table stores information about locks that InnoDB transactions have requested but not yet acquired, or that is blocking another transaction.

It has the following columns:

Column Description
LOCK_ID Lock ID number - the format is not fixed, so do not rely upon the number for information.
LOCK_TRX_ID Lock's transaction ID. Matches the INNODB_TRX.TRX_ID column.
LOCK_MODE Lock mode. One of S (shared), X (exclusive), IS (intention shared), IX (intention exclusive row lock), S_GAP (shared gap lock), X_GAP (exclusive gap lock), IS_GAP (intention shared gap lock), IX_GAP (intention exclusive gap lock) or AUTO_INC (auto-increment table level lock).
LOCK_TYPE Whether the lock is RECORD (row level) or TABLE level.
LOCK_TABLE Name of the locked table,or table containing locked rows.
LOCK_INDEX Index name if a RECORD LOCK_TYPE, or NULL if not.
LOCK_SPACE Tablespace ID if a RECORD LOCK_TYPE, or NULL if not.
LOCK_PAGE Locked record page number if a RECORD LOCK_TYPE, or NULL if not.
LOCK_REC Locked record heap number if a RECORD LOCK_TYPE, or NULL if not.
LOCK_DATA Locked record primary key as an SQL string if a RECORD LOCK_TYPE, or NULL if not. If no primary key exists, the internal InnoDB row_id number is instead used. To avoid unnecessary IO, also NULL if the locked record page is not in the buffer pool

The table is often used in conjunction with the INNODB_LOCK_WAITS and INNODB_TRX tables to diagnose problematic locks and transactions.

Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.

© 2019 MariaDB
Licensed under the Creative Commons Attribution 3.0 Unported License and the GNU Free Documentation License.