The INFORMATION_SCHEMA INNODB_LOCKS
Table
The INNODB_LOCKS
table contains information about each lock that an InnoDB
transaction has requested but not yet acquired, and each lock that a transaction holds that is blocking another transaction.
Table 18.4. INNODB_LOCKS
Columns
Column name | Description |
---|---|
LOCK_ID
| Unique lock ID number, internal to InnoDB . Should be treated as an opaque string. Although LOCK_ID currently contains TRX_ID , the format of the data in LOCK_ID is not guaranteed to remain the same in future releases. You should not write programs that parse the LOCK_ID value.
|
LOCK_TRX_ID
| ID of the transaction holding this lock. Details about the transaction can be found by joining with INNODB_TRX on TRX_ID .
|
LOCK_MODE
| Mode of the lock. One of S , X , IS , IX , S_GAP , X_GAP , IS_GAP , IX_GAP , or AUTO_INC for shared, exclusive, intention shared, intention exclusive row locks, shared and exclusive gap locks, intention shared and intention exclusive gap locks, and auto-increment table level lock, respectively. Refer to the sections , "InnoDB Lock Modes" and , "The InnoDB Transaction Model and Locking" for information on InnoDB locking.
|
LOCK_TYPE
| Type of the lock. One of RECORD or TABLE for record (row) level or table level locks, respectively.
|
LOCK_TABLE
| Name of the table that has been locked or contains locked records. |
LOCK_INDEX
| Name of the index if LOCK_TYPE='RECORD' , otherwise NULL .
|
LOCK_SPACE
| Tablespace ID of the locked record if LOCK_TYPE='RECORD' , otherwise NULL .
|
LOCK_PAGE
| Page number of the locked record if LOCK_TYPE='RECORD' , otherwise NULL .
|
LOCK_REC
| Heap number of the locked record within the page if LOCK_TYPE='RECORD' , otherwise NULL .
|
LOCK_DATA
| Primary key of the locked record if LOCK_TYPE='RECORD' , otherwise NULL . This column contains the value(s) of the primary key column(s) in the locked row, formatted as a valid SQL string (ready to be copied to SQL commands). If there is no primary key then the InnoDB internal unique row ID number is used. When the page containing the locked record is not in the buffer pool (in the case that it was paged out to disk while the lock was held), InnoDB does not fetch the page from disk, to avoid unnecessary disk operations. Instead, LOCK_DATA is set to NULL . |
Notes:
- Use this table to help diagnose performance problems that occur during times of heavy concurrent load.
- You must have the
PROCESS
privilege to query this table. - For usage information, see , "Using the Transaction Information Schema Tables".