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:

ColumnDescription
LOCK_IDLock ID number - the format is not fixed, so do not rely upon the number for information.
LOCK_TRX_IDLock's transaction ID. Matches the INNODB_TRX.TRX_ID column.
LOCK_MODELock 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_TYPEWhether the lock is RECORD (row level) or TABLE level.
LOCK_TABLEName of the locked table,or table containing locked rows.
LOCK_INDEXIndex name if a RECORD LOCK_TYPE, or NULL if not.
LOCK_SPACETablespace ID if a RECORD LOCK_TYPE, or NULL if not.
LOCK_PAGELocked record page number if a RECORD LOCK_TYPE, or NULL if not.
LOCK_RECLocked record heap number if a RECORD LOCK_TYPE, or NULL if not.
LOCK_DATALocked 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.

Comments

Comments loading...
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.