content_image/665652.jpg
acquired by a transaction, all incompatible lock requests previously entered into the lock queue for that row or table must be removed (which occurs when the transactions holding or requesting those locks either commit or roll back). 

A transaction may have any number of lock requests for different rows or tables. At any given time, a transaction may request a lock that is held by another transaction, in which case it is blocked by that other transaction. The requesting transaction must wait for the transaction that holds the blocking lock to commit or roll back. If a transaction is not waiting for a lock, it is in a RUNNING  state. If a transaction is waiting for a lock, it is in a LOCK WAIT  state. (The INFORMATION_SCHEMA INNODB_TRX  table indicates transaction state values.) 

The Performance Schema data_locks  table holds one or more rows for each LOCK WAIT  transaction, indicating any lock requests that prevent its progress. This table also contains one row describing each lock in a queue of locks pending for a given row or table. The Performance Schema data_lock_waits table shows which locks already held by a transaction are blocking locks requested by other transactions. 

## 15.15.2.3 Persistence and Consistency of InnoDB Transaction and Locking Information 

<img src='content_image/665652.jpg'>

## Note 

This section describes locking information as exposed by the Performance Schema data_locks  and data_lock_waits  tables, which supersede the INFORMATION_SCHEMA INNODB_LOCKS  and INNODB_LOCK_WAITS tables in MySQL 8.0. For similar discussion written in terms of the older INFORMATION_SCHEMA  tables, see Persistence and Consistency of InnoDB Transaction and Locking Information, in MySQL 5.7 Reference Manual. 

The data exposed by the transaction and locking tables ( INFORMATION_SCHEMA INNODB_TRX  table, Performance Schema data_locks  and data_lock_waits  tables) represents a glimpse into fast- changing data. This is not like user tables, where the data changes only when application-initiated updates occur. The underlying data is internal system-managed data, and can change very quickly: 

•Data might not be consistent between the INNODB_TRX , data_locks , and data_lock_waits  tables. 

The data_locks  and data_lock_waits  tables expose live data from the InnoDB  storage engine, to provide lock inormation about the transactions in the INNODB_TRX  table. Data retrieved from the lock tables exists when the SELECT  is executed, but might be gone or changed by the time the query result is consumed by the client. 

Joining data_locks  with data_lock_waits  can show rows in data_lock_waits  that identify a parent row in data_locks  that no longer exists or does not exist yet. 

•Data in the transaction and locking tables might not be consistent with data in the INFORMATION_SCHEMA PROCESSLIST  table or Performance Schema threads  table. 

For example, you should be careful when comparing data in the InnoDB  transaction and locking tables with data in the PROCESSLIST  table. Even if you issue a single SELECT  (joining INNODB_TRX and PROCESSLIST , for example), the content of those tables is generally not consistent. It is possible for INNODB_TRX  to reference rows that are not present in PROCESSLIST  or for the currently executing SQL query of a transaction shown in INNODB_TRX.TRX_QUERY  to differ from the one in PROCESSLIST.INFO . 

## 15.15.3 InnoDB INFORMATION_SCHEMA Schema Object Tables 

You can extract metadata about schema objects managed by InnoDB  using InnoDB INFORMATION_SCHEMA  tables. This information comes from the data dictionary. Traditionally, you would 

