MySQL 查看进行中的事务

如题, SQL如下:

select 
  t1.trx_mysql_thread_id,
  t1.trx_state,
  t1.trx_started,
  t1.trx_query,
  t2.PROCESSLIST_DB,
  t2.PROCESSLIST_USER,
  t2.PROCESSLIST_ID,
  t2.PROCESSLIST_HOST,
  t2.PROCESSLIST_STATE,
  t2.PROCESSLIST_COMMAND
from information_schema.innodb_trx t1
join performance_schema.threads t2 on t1.trx_mysql_thread_id = t2.PROCESSLIST_ID
;

 

posted @ 2021-01-20 16:17  Beef Liu  阅读(264)  评论(0编辑  收藏  举报