介绍
5.7.7 引入 sys 系统库,专注于MySQL易用性,分析问题和定位问题,将更多的依赖sys schema,减少外部工具的使用
For Linux users I like to compare performance_schema to /proc, and SYS to vmstat.
performance schema和information schema中提供了信息源,但是,没有很好的将这些信息组织成有用的信息,从而没有很好的发挥它们的作用
哪些语句使用了临时表,哪个用户请求了最多的io,哪个线程占用了最多的内存,哪些索引是无用索引等
select * from host_summary_by_file_io;
host| ios| io_latency |
background | 2143 | 266.48 ms |
172.17.42.1 | 1748 | 116.52 ms |
select * from x$host_summary_by_file_io;
host| ios | io_latency |
background | 2148 | 266558291670 |
172.17.42.1 | 1748 | 116518395300 |
前一种便于人类阅读的形式,格式化了时间单位和字节单位,另外一种便于工具处理
索引相关
- 查冗余索引
5.5.7前,percona pt-duplicate-key-checker,现在直接
select * sys.schema_redundant_indexes
- 未使用的索引
select * from schema_unused_indexes;
- 全表扫描
select * from statements_with_full_table_scans