mysql中headler_read计数器理解

mysqlheadler_read计数器,这些计数器对理解调优有一定的帮助

 


首先7个计数器,我们应该分为两部分:
1)对索引读的计数器:前面的5个都是对索引读情况的计数器,
     Handler_read_first:是指读索引的第一项(的次数);
     Handler_read_key:是指读索引的某一项(的次数);
     Handler_read_next:是指读索引的下一项(的次数);
     Handler_read_last:是指读索引的最后第一项(的次数);
     Handler_read_prev:是指读索引的前一项(的次数);
5者应该有四种组合:
1. Handler_read_first 和 Handler_read_next 组合应该是索引覆盖扫描
2. Handler_read_key 基于索引取值
3. Handler_read_key 和 Handler_read_next 组合应该是索引范围扫描
4. Handler_read_last 和 Handler_read_prev 组合应该是索引范围扫描(orde by desc)

2)对数据文件的计数器:后面的2个都是对数据文件读情况的计数器,
Handler_read_rnd:
The number of requests to read a row based on a fixed position. This value is high if you are doing alot of queries that require sorting of the result. You probably have a lot of queries that require MySQL toscan entire tables or you have joins thatdo not use keys properly.

Handler_read_rnd_next

The number of requests to read the next row in the data file. This value is high if you are doing a lot of
table scans. Generally this suggests that your tables are not properly indexed or that your queries are
not written to take advantage of the indexes you have.

这里很重要的一点要理解:索引项之间都是有顺序的,所以才有first, last, next, prev等等,所以前面的5个都是对索引读情况
的计数器,而后面的2个是对数据文件的读情况的计数器。

很显然的一点:
后面的2个 Handler_read_rnd 和 Handler_read_rnd_next 是越低越好,如果很高,应该进行索引相关的调优。而Handler_read_key的数值
肯定是越高越好,越高代表使用索引读很高。其他的计数器,要具体情况具体分析 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值