Updated on 2023-11-03 GMT+08:00

Locating Long Transactions

Scenario

If a long transaction alarm is generated, you can locate the long transaction.

Troubleshooting

Run the following statement to check the execution duration of the current transaction and determine whether it is a long transaction:

Select t.*,to_seconds(now())-to_seconds(t.trx_started) idle_time from INFORMATION_SCHEMA.INNODB_TRX t;

In the command output, trx_query indicates the SQL statement that is being executed by the transaction. If its value is NULL, the transaction is in the waiting state and does not execute any SQL statement.

For details, see The INFORMATION_SCHEMA INNODB_TRX Table.