千金良方:MySQL性能优化金字塔法则
上QQ阅读APP看本书,新人免费读10天
设备和账号都新为新人

9.8 查看MySQL磁盘文件产生的磁盘流量与读写比例

使用io_global_by_file_by_bytes视图可以按照文件路径+名称分组(磁盘文件名)查看全局的I/O读写字节数、读写文件I/O事件数量统计信息,在默认情况下按照总I/O读写字节数进行降序排列。数据来源:performance_schema.file_summary_by_instance。

下面是使用io_global_by_file_by_bytes视图查询的结果集。

mysql> select * from io_global_by_file_by_bytes limit 3;
+-------+-------+--------+-------+--------+--------+---------+---------+-----------+
| file | count_read | total_read | avg_read| count_write |total_written | avg_write |total | write_pct |
+-------+-------+--------+-------+--------+--------+---------+---------+-----------+
|@@innodb_data_home_dir/ibtmp1|0|0  bytes|0  bytes|2798|55.53MiB|20.32  KiB|55.53MiB|100.00|
|@@innodb_undo_directory/undo002|874|13.66   MiB|16.00KiB|0|0   bytes|0   bytes|13.66 MiB| 0.00 |
|@@innodb_data_home_dir/ibdata1|31|2.50  MiB|82.58  KiB|3|64.00KiB|21.33  KiB|2.56MiB|2.44 |
+-------+-------+--------+-------+--------+--------+---------+---------+-----------+
3 rows in set(0.00 sec)