查看mysql當前事務鎖並kill

執行如下SQL,查看當前事務:

select
  t.trx_mysql_thread_id,
  t.trx_started,
  t.trx_state,
  t.trx_tables_in_use,
  t.trx_tables_locked,
  t.trx_rows_locked,
  timestampdiff(second, t.trx_started, now()) as trx_run_seconds,
  concat(e.timer_wait/1000000000000, 's') as timer_wait_seconds
from information_schema.innodb_trx t
join performance_schema.threads c on c.processlist_id=t.trx_mysql_thread_id
join performance_schema.events_statements_current e on e.thread_id=c.thread_id

  返回是trx_mysql_thread_id就是線程ID,通過kill命令可以終止線程。

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章