Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

explain执行计划看过没有?其中type字段都有哪些值?分别代表什么? #8

Open
cq0206 opened this issue Apr 8, 2021 · 1 comment
Labels

Comments

@cq0206
Copy link
Owner

cq0206 commented Apr 8, 2021

explain执行计划看过没有?其中type字段都有哪些值?分别代表什么?

@cq0206 cq0206 added the mysql label Apr 8, 2021
@cq0206
Copy link
Owner Author

cq0206 commented Apr 8, 2021

在日常工作中,我们的项目如果发现查询很慢了,往往会去查看MySQL的慢查询日志,找到对应的SQL;
找到这个SQL并不就此完事儿了,还会对当前SQL进行优化;使用MySQL的explain命令,将会事半功倍!

但是就目前来看,explain指令的解析都是文字,大量的文字!一点不形象、不直观、使用的时候查起来也非常麻烦,因此,我做了一张表格,供大家参考和查阅。

以下是Mysql执行计划的图解。在使用explain的时候可以参考使用。

概要描述:
id:选择标识符
select_type:表示查询的类型。
table:输出结果集的表
partitions:匹配的分区
type:表示表的连接类型
possible_keys:表示查询时,可能使用的索引
key:表示实际使用的索引
key_len:索引字段的长度
ref:列与索引的比较
rows:扫描出的行数(估算的行数)
filtered:按表条件过滤的行百分比
Extra:执行情况的描述和说明

explain

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant