类型 | 开头 | 描述 |
主机相关 | host_summary | 主要汇总了IO延迟信息 |
InnoDB相关 | innodb | 汇总了InnoDB的缓存信息和事务等待InnoDB锁的信息 |
IO相关 | io | 汇总了等待IO、IO使用量情况 |
内存使用情况 | memory | 从主机、线程、事件等角度展示内存的使用情况 |
连接语会话信息 | processlist和session相关视图 | 总结了会话相关信息 |
表相关 | schema_table | 展示了表的统计信息 |
索引信息 | 统计了索引的使用情况,包含冗余索引和未使用的索引 | |
语句相关 | statement | 包含执行全表扫描、临时表、排序等语句信息 |
用户相关 | user | 统计了用户使用的文件IO、执行语句统计信息 |
等待事件相关 | wait | 展示等待事件的延迟情况 |
mysql> select * from sys.schema_redundant_indexes;
mysql> select * from sys.schema_unused_indexes;
mysql> select index_name, rows_selected, rows_inserted, rows_updated, rows_deleted from sys.schema_index_statistics where table_schema = 'review_mysql';
mysql> select table_schema, table_name, sum(io_read_requests + io_write_requests) as io from sys.schema_table_statistics group by table_schema, table_name order by io desc;
mysql> select object_schema, object_name, allocated, data from sys.innodb_buffer_stats_by_table order by allocated limit 10;
mysql> select * from sys.statements_with_full_table_scans where db = 'review_mysql';
mysql> select db, exec_count, query from sys.statement_analysis order by exec_count desc;
mysql> select db, exec_count, first_seen, last_seen, query from sys.statements_with_sorting limit 1;
mysql> select db, exec_count, tmp_tables, tmp_disk_tables, query from sys.statement_analysis where tmp_tables > 0 or tmp_disk_tables > 0 order by (tmp_tables + tmp_disk_tables) desc;
查看消耗磁盘IO的文件:
mysql> select file, avg_read, avg_write, avg_read + avg_write as avg_io from sys.io_global_by_file_by_bytes order by avg_read limit 10;
行锁阻塞情况:
mysql> select * from sys.innodb_lock_waits;