当前位置:网站首页>MYSQL 主从恢复锁表后, 处理SQL 线程锁解决.
MYSQL 主从恢复锁表后, 处理SQL 线程锁解决.
2022-07-30 05:55:00 【网络笨猪】
1. 按客户端 IP 分组,看哪个客户端的链接数最多
select client_ip,count(client_ip) as client_num from (select substring_index(host,':' ,1) as client_ip from information_schema.processlist ) as connect_info group by client_ip order by client_num desc;
2. 查看正在执行的线程,并按 Time 倒排序,看看有没有执行时间特别长的线程
select * from information_schema.processlist where Command != 'Sleep' order by Time desc;
3. 查询当前运行的所有事物:
select * from information_schema.innodb_trx \G
4. 清理掉所有状态不是Sleep且等待时间待遇5分钟的sql进程, 一般都是Query: “Waiting for global read lock”
select concat('kill ', id, ';') from information_schema.processlist where Command != 'Sleep' and Time > 300 order by Time desc;
边栏推荐
- 【MySQL】MySQL中如何实现分页操作
- When does MySQL use table locks and when does it use row locks?
- 新人误删数据,组长巧用MySQL主从复制延迟挽回损失
- go : 使用gorm查询记录
- assert
- 云服务器零基础部署网站(保姆级教程)
- golang : Zap log integration
- Linx common directory & file management commands & VI editor usage introduction
- STL源码剖析:class template explicit specialization代码测试和理解
- What new materials are used in the large aircraft C919?
猜你喜欢

The calculation proof of the intersection of the space line and the plane and its source code

UDP和TCP使用同一个端口,可行吗?

识别“数据陷阱”,发现数据的可疑之处

空间顶点到直线的距离计算及其源码

2020年度总结——品曾经,明得失,展未来

MySQL master-slave replication configuration construction, one step in place

ETL为什么经常变成ELT甚至LET?

Polygon 3D(三维平面多边形)的法向量的计算(MeshLab默认的计算)

LVM and disk quotas

什么是微服务?
随机推荐
Test Development Engineer Growth Diary 015 - Top 20 Test Interview Questions
Process and Scheduled Task Management
阿里二面:列出 Api 接口优化的几个技巧
The first artificial intelligence safety competition officially launched
export , export default, import complete usage
CTO说不建议我使用SELECT * ,这是为什么?
头条二面:MySQL中有几种常见的 SQL 错误用法?
2020 ACM | MoFlow: An Invertible Flow Model for Generating Molecular Graphs
Electron使用romote报错 : Uncaught TypeError: Cannot read property ‘BrowserWindow‘ of undefined
Develop common tool software
大飞机C919都用了哪些新材料?
debian problem
空间顶点到平面的距离计算的证明及其源码
Go语学习笔记 - gorm使用 - 数据库配置、表新增 Web框架Gin(七)
assert
预测人们对你的第一印象,“AI颜狗”的诞生
[硬核干货]由0到1,突破信息系统项目管理师(呕心沥血经验之谈)!!!
Redis 如何实现防止超卖和库存扣减操作?
What happens when @Bean and @Component are used on the same class?
Table with tens of millions of data, how to query the fastest?