Crazy lens

Mysql 查看表锁SQL
Mysql 查看表锁SQLSELECT pr.id, pr.user, pr.host, pr....
扫描右侧二维码阅读全文
01
2018/08

Mysql 查看表锁SQL

Mysql 查看表锁SQL

SELECT 
  pr.id,
  pr.user,
  pr.host,
  pr.db,
  pr.command,
  pr.time,
  inn.trx_state,
  inn.trx_started,
  pr.info,
  tt.id,
  tt.user,
  tt.host,
  tt.command,
  tt.time,
  tt.trx_state,
  tt.trx_started,
  tt.info 
FROM
  information_schema.processlist pr,
  information_schema.innodb_trx inn,
  (SELECT 
    p.id,
    p.user,
    p.host,
    p.db,
    p.command,
    p.time,
    i.trx_state,
    i.trx_started,
    p.info,
    l.blocking_trx_id 
  FROM
    information_schema.processlist p,
    information_schema.innodb_trx i,
    information_schema.innodb_lock_waits l 
  WHERE p.id = i.trx_mysql_thread_id 
    AND i.trx_id = l.requesting_trx_id) tt 
WHERE pr.id = inn.trx_mysql_thread_id 
  AND inn.trx_id = tt.blocking_trx_id;

感谢DBA

最后修改:2018 年 08 月 01 日 11 : 22 PM
如果觉得我的文章对你有用,请随意赞赏

发表评论