Created
April 4, 2024 17:33
-
-
Save NeilMasters/5d053bd34cffc58edf08bac673a1d706 to your computer and use it in GitHub Desktop.
List all long running transactions on a mysql database server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
a.trx_id, a.trx_state, a.trx_started, | |
TIMESTAMPDIFF(SECOND,a.trx_started, now()) as "Seconds Transaction Has Been Open", | |
a.trx_rows_modified, | |
b.USER, b.host, b.db, b.command, b.time, b.state | |
FROM | |
information_schema.innodb_trx a | |
INNER JOIN | |
information_schema.processlist b ON b.id = a.trx_mysql_thread_id | |
ORDER BY | |
trx_started; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment