其他分享
首页 > 其他分享> > mysq1l Innodb中监控阻塞

mysq1l Innodb中监控阻塞

作者:互联网

Innodb中监控阻塞

select b.trx_mysql_thread_id AS'被阻塞线程'
,b.trx_query AS '被阻塞SQL'
,c.trx_mysql_thread_id AS '阻塞线程'
,c.trx_query AS '阻塞SQL'
,(UNIX_TIMESTAMP()-UNIX_TIMESTAMP(c.trx_started)) AS '阻塞时间'
FROM information_schema.innodb_lock_waits a
JOIN information_schema.innodb_trx b ON a.requesting_trx_id=b.trx_id
JOIN information_schema.innodb_trx c ON a.blocking_trx_id=c.trx_id
#WHERE (UNIX_TIMESTAMP()-UNIX_TIMESTAMP(c.trx_started))>60

 

#查询当前连接号
select connection_id()

#设置超时间

set globel innodb_lock_wait_timeout=180;

user test;

select * from t for update;

标签:mysq1l,TIMESTAMP,阻塞,trx,UNIX,Innodb,innodb,id
来源: https://www.cnblogs.com/xiaoruilin/p/16534797.html