Explain工具-SQL性能优化
发布时间:2023年12月18日
SQL性能优化的目标
达到 range 级别
Explain中type效率级别(重要)
显示的是单位查询的连接类型或者理解为访问类型,访问性能依次从好到差:
- system
- const
- eq_ref
- ref
- fulltext
- ref_or_null
- unique_subquery
- index_subquery
- range
- index_merge
- index
- ALL
注意
- 除了all之外,其他的type都可以使用到索引
- 除了index_merge之外,其他的type只可以用到一个索引
- 最少要使用到range级别
Explain+覆盖索引
Extra中Using index表示覆盖索引

Explain+index
type中是index,代表全索引扫描,磁盘扫描。

Explain+filesort
Explain+filesort
Extra中 using filesort

创建 idx_bd(b,d)

type/possible_keys/key/Extra

文章来源:https://blog.csdn.net/i973635025/article/details/135043158
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如若内容造成侵权/违法违规/事实不符,请联系我的编程经验分享网邮箱:chenni525@qq.com进行投诉反馈,一经查实,立即删除!