时间:2021-07-01 10:21:17 帮助过:17人阅读
show status like ‘innodb_row_lock%‘;
关注的信息
Innodb_row_lock_current_waits: 当前有多少锁等待
Innodb_row_lock_waits: 一共发生多少个锁等待(自打数据库启动起来,发生过多少锁等待!相当于一个计数器,重启以后会重新计数)
select locked_table,locked_type,waiting_trx_id,waiting_pid,waiting_query,waiting_lock_mode,blocking_trx_id,blocking_pid,sql_kill_blocking_connection from sys.innodb_lock_waits\G;
-参数说明
locked_table:产生锁等待的表
locked_type:锁的类型(RECORD,gaplock,nextlock)
waiting_trx_id: 等待的事物的ID
waiting_pid: 等待事物的连接线程ID
waiting_query: 等待事物的语句
waiting_lock_mode:等待锁的类型(X,S)
blocking_trx_id: 锁源的事物ID
blocking_pid: 锁源的事物连接线程ID
sql_kill_blocking_connection: 处理建议
select thread_id,name,processlist_id from performance_schema.threads where processlist_id=4;
这一步得到在SQL层,执行SQL语句的thread_id=29
select thread_id,event_name,sql_text from performance_schema.`events_statements_current` where thread_id=29;
把得到的语句丢给开发
数据库锁的排查
标签:RoCE 关注 ssl inno pre ESS 参数 pid tab