文章目录
- 也不想多写什么
- https://dev.mysql.com/doc/refman/8.0/en/explain-output.html
- https://dev.mysql.com/doc/refman/5.7/en/explain-output.html
- 需要说明的是 extra 的
Using where
,网上很多解释是此信息表明需要回表查询;但是在 字段a的索引上执行select a from t where a>1
这种类似的语句也会出现Using where
,这从逻辑上就说不过去,mysql 的优化器也没有这么傻吧; - 文档中的原文是这样的:
Using where (JSON property: attached_condition)
A WHERE clause is used to restrict which rows to match against the next table or send to the client. Unless you specifically intend to fetch or examine all rows from the table, you may have something wrong in your query if the Extra value is not Using where and the table join type is ALL or index.
Using where has no direct counterpart in JSON-formatted output; the attached_condition property contains any WHERE condition used.
- 直白的翻译是:WHERE 子句用于限制哪些行与下一个表匹配或发送给客户机。除非您特意打算从表中获取或检查所有行,否则如果额外的值没有使用where,并且表联接类型为all或index,则查询中可能有错误。
- 简要概括是:使用 where 子句中的字段进行结果过滤。
- 并没有表明需要回表之类的操作,至少从文档解释来看是没有的;而sql执行逻辑上也是没有必要的。