Skip to content

Instantly share code, notes, and snippets.

@victorpendleton
Last active September 30, 2016 19:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save victorpendleton/baf9913895546de012aad8dbe10e9c4a to your computer and use it in GitHub Desktop.
Save victorpendleton/baf9913895546de012aad8dbe10e9c4a to your computer and use it in GitHub Desktop.
Get information about active transactions
SELECT t.trx_id
, t.trx_mysql_thread_id
, p.User
, SUBSTRING(p.Host, 1, LOCATE(':', p.Host) -1) AS Host
, SUBSTRING(p.Host, LOCATE(':', p.Host) + 1) AS Port
, t.trx_state
, t.trx_started
, ROUND(p.Time/60, 2) Mins
, p.command
, p.State
, p.rows_sent
, p.rows_examined
, round(p.rows_sent/p.rows_examined, 4) Percent_Complete
, SUBSTRING(t.trx_query, 1, 50) AS Query
FROM information_schema.innodb_trx t
INNER JOIN information_schema.processlist p
ON t.trx_mysql_thread_id = p.id;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment