Last active
June 23, 2020 07:56
-
-
Save yangvipguang/46d1080d472f96dd206059646f83531f to your computer and use it in GitHub Desktop.
MySQL 性能
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1、统计top 10的buffer pool占用内存的表 | |
select * from innodb_buffer_stats_by_table order by pages desc limit 10; | |
2、统计mysql物理文件的物理io写入字节数(可以定位出一个表的读写io占比和实际的平均写入量来判断占用io资源) | |
select * from io_global_by_file_by_bytes limit 10; | |
3、当前运行的所有事务 | |
SELECT * FROM INFORMATION_SCHEMA.INNODB_TRX\G | |
4、表信息 | |
show status like 'Table%'; | |
Table_locks_immediate 指的是能够立即获得表级锁的次数 | |
Table_locks_waited 指的是不能立即获取表级锁而需要等待的次数 | |
5、当前锁 | |
SELECT * FROM INFORMATION_SCHEMA.INNODB_LOCKS; | |
6、查看正被锁表 | |
show OPEN TABLES where In_use > 0; | |
SELECT * FROM INFORMATION_SCHEMA.INNODB_LOCK_WAITS; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment