这通常说明频繁的全索引扫描。全索引扫描虽然比全表扫描快,但在大表中仍然需要一定 CPU 周期,如果这些表有或有过大量 UPDATE 和 DELETE,运行 'OPTIMIZE TABLE' 可减少全索引扫描的次数以及提高速度。其它会减少全索引扫描的是重写查询。
Justification:
索引扫描率: 13 每分钟,该值应低于 1 每小时
Used variable / formula:
Handler_read_first / Uptime
Test:
value * 60 * 60 > 1
Issue:
从固定位置读取数据的比例过高。
Recommendation:
这说明很多查询需要结果排序且/或执行一次全表扫描,包括无索引的联合查询。请在合适的地方添加索引。
Justification:
固定位置读取率: 22.65 每秒,该值应低于 1 每小时
Used variable / formula:
Handler_read_rnd / Uptime
Test:
value * 60 * 60 > 1
Issue:
读取下一行的比例过高。
Recommendation:
这说明很多查询都需要全表扫描。请在合适的地方添加索引。
Justification:
下一行读取率: 2072.27 每秒,该值应低于 1 每小时
Used variable / formula:
Handler_read_rnd_next / Uptime
Test:
value * 60 * 60 > 1
Issue:
很多临时表被创建在磁盘上而非内存中。
Recommendation:
Increasing max_heap_table_size and tmp_table_size might help. However some temporary tables are always being written to disk, independent of the value of these variables. To eliminate these you will have to rewrite your queries to avoid those conditions (Within a temporary table: Presence of a BLOB or TEXT column or presence of a column bigger than 512 bytes) as mentioned in the MySQL Documentation