Information Schema INNODB_TRX Table

The Information Schema INNODB_TRX table stores information about all currently executing InnoDB transactions.

It has the following columns:

ColumnDescription
TRX_IDUnique transaction ID number.
TRX_STATETransaction execution state; one of RUNNING, LOCK WAIT, ROLLING BACK or COMMITTING.
TRX_STARTEDTime that the transaction started.
TRX_REQUESTED_LOCK_IDIf TRX_STATE is LOCK_WAIT, the INNODB_LOCKS.LOCK_ID value of the lock being waited on. NULL if any other state.
TRX_WAIT_STARTEDIf TRX_STATE is LOCK_WAIT, the time the transaction started waiting for the lock, otherwise NULL.
TRX_WEIGHTTransaction weight, based on the number of locked rows and the number of altered rows. To resolve deadlocks, lower weighted transactions are rolled back first. Transactions that have affected non-transactional tables are always treated as having a heavier weight.
TRX_MYSQL_THREAD_IDThread ID from the PROCESSLIST table (note that the locking and transaction information schema tables use a different snapshot from the processlist, so records may appear in one but not the other).
TRX_QUERYSQL that the transaction is currently running.
TRX_OPERATION_STATETransaction's current state, or NULL.
TRX_TABLES_IN_USENumber of InnoDB tables currently being used for processing the current SQL statement.
TRX_TABLES_LOCKEDNumber of InnoDB tables that that have row locks held by the current SQL statement.
TRX_LOCK_STRUCTSNumber of locks reserved by the transaction.
TRX_LOCK_MEMORY_BYTESTotal size in bytes of the memory used to hold the lock structures for the current transaction in memory.
TRX_ROWS_LOCKEDNumber of rows the current transaction has locked. locked by this transaction. An approximation, and may include rows not visible to the current transaction that are delete-marked but physically present.
TRX_ROWS_MODIFIEDNumber of rows added or changed in the current transaction.
TRX_CONCURRENCY_TICKETSIndicates how much work the current transaction can do before being swapped out, see the innodb_concurrency_tickets system variable.
TRX_ISOLATION_LEVELIsolation level of the current transaction.
TRX_UNIQUE_CHECKSWhether unique checks are on or off for the current transaction. Bulk data are a case where unique checks would be off.
TRX_FOREIGN_KEY_CHECKSWhether foreign key checks are on or off for the current transaction. Bulk data are a case where foreign keys checks would be off.
TRX_LAST_FOREIGN_KEY_ERRORError message for the most recent foreign key error, or NULL if none.
TRX_ADAPTIVE_HASH_LATCHEDWhether the adaptive hash index is locked by the current transaction or not. One transaction at a time can change the adaptive hash index.
TRX_ADAPTIVE_HASH_TIMEOUTWhether the adaptive hash index search latch shoild be relinquished immediately or reserved across all MariaDB calls. 0 if there is no contention on the adaptive hash index, in which case the latch is reserved until completion, otherwise counts down to zero and the latch is released after each row lookup.
TRX_IS_READ_ONLY1 if a read-only transaction, otherwise 0.
TRX_AUTOCOMMIT_NON_LOCKING1 if the transaction only contains this one statement, that is, a SELECT statement not using FOR UPDATE or LOCK IN SHARED MODE, and with autocommit on. If this and TRX_IS_READ_ONLY are both 1, the transaction can be optimized by the storrage engine to reduce some overheads

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

XA transactions are not stored in this table. To see them, XA RECOVER can be used.

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.