示例
示例
-- 走全表扫描的语句
SELECT query, exec_count, total_latency, rows_examined
FROM sys.statements_with_full_table_scans
ORDER BY exec_count DESC
LIMIT 10;
-- 表级读写与 IO 延迟
SELECT table_schema, table_name, rows_fetched, io_read_latency
FROM sys.schema_table_statistics
ORDER BY io_read_latency DESC
LIMIT 10;
-- 实例启动以来未被使用的索引
SELECT * FROM sys.schema_unused_indexes;| 数据来源 | performance_schema 汇总表;实例重启后统计清零 |
|---|---|
| schema_unused_indexes | 按索引使用统计列出未命中索引;主键不参与统计 |
| 前提 | 相关 instrument 与 consumer 处于开启状态(默认配置通常可用) |