美文网首页
慢sql排查

慢sql排查

作者: 小陈阿飞 | 来源:发表于2024-02-19 16:19 被阅读0次
STATUS
image.png
STATUS解释

Handler_read_first
The number of times the first entry was read from an index.
If ``this value is high, it suggests that the server is doing a lot of full index scans;
for example, SELECT col1 FROM foo, assuming that col1 is indexed.
索引中第一条被读的次数。如果较高,它建议服务器正执行大量全索引扫描;例如,SELECT col1 FROM foo,假定col1有索引。

Handler_read_key
The number of requests to read a row based on a key.
If ``this value is high, it is a good indication that your tables are properly indexed ``for your queries.
根据键读一行的请求数。如果较高,说明查询和表的索引正确。

Handler_read_next
The number of requests to read the next row in key order.
This value is incremented ``if you are querying an index column with a range constraint or ``if you are doing an index scan.

按照键顺序读下一行的请求数。如果你用范围约束或如果执行索引扫描来查询索引列,该值增加。

Handler_read_prev
The number of requests to read the previous row in key order.
This read method is mainly used to optimize ORDER BY ... DESC.

按照键顺序读前一行的请求数。该读方法主要用于优化ORDER BY ... DESC。

Handler_read_rnd
The number of requests to read a row based on a fixed position.
This value is high ``if you are doing a lot of queries that require sorting of the result.
You probably have a lot of queries that require MySQL to scan entire tables or you have joins that don't use keys properly.

根据固定位置读一行的请求数。如果你正执行大量查询并需要对结果进行排序该值较高。你可能使用了大量需要MySQL扫描整个表的查询或你的连接没有正确使用键。

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.
|

在数据文件中读下一行的请求数。如果你正进行大量的表扫描,该值较高。通常说明你的表索引不正确或写入的查询没有利用索引。

从第二条执行计划可以看出,shotel表只用到idx_supplier_id并没有用到shotel的主键,handler_read_rev数值很大,猜测应该是扫描得到结果,所以速度很慢。

相关文章

  • SQL优化以及锁表总结

    一、慢SQL的排查与分析 1、慢sql的定位使用Druid监控oracle的ARW文件mysql慢日志或使用命令s...

  • MySQL技术专题(7)优化方案-SQL 慢查询日志

    SQL排查[https://www.jianshu.com/writer] 慢查询日志: ** MySQL提供的一...

  • mysql慢查询日志

    慢查询日志 MySQL 慢查询日志是排查问题 SQL 语句,以及检查当前 MySQL 性能的一个重要功能,执行时间...

  • java面试题 --- MySQL③

    1. 生产环境中一条 SQL 执行特别慢,你要如何排查问题?可以查看 SQL 的执行计划。 2. 执行计划怎么用?...

  • 后端存储8(处理慢SQL)

    慢 SQL的排查与防范 1,观察MySQL 的 CPU 利用率图,从监控图上看,故障时段 MySQL 的 CPU ...

  • mysql开启慢查询sql日志

    MySQL 慢查询日志是排查问题 SQL 语句,以及检查当前 MySQL 性能的一个重要功能。 开启状态:查看是否...

  • 数据库内存,CPU过高排查

    一、先排查业务层面 绝大多情况是由于sql问题导致,因此需要优先从sql排查。先登录mysql,通过mysql> ...

  • 记录一次慢sql排查

    mysql的慢日志中,看到有这么一条 不算太复杂的一条sql,但是扫了200多万行的数据,所以慢。先看执行计划 m...

  • 一文读懂 MySQL Explain 执行计划

    一、前言 上周老周的一个好朋友让我出一篇教你读懂 SQL 执行计划,和我另一位读者反馈的面试题如何排查慢 SQL ...

  • TiDB执行计划(一)

    最近排查了项目中TiDB慢sql,查询执行计划时,发现TiDB执行计划详情和mysql的还有一些区别,今天来学习分...

网友评论

      本文标题:慢sql排查

      本文链接:https://www.haomeiwen.com/subject/snevadtx.html