That is, MySQL explains how it would process the statement, including information about how tables are joined and in which order. For information about using EXPLAIN to obtain execution plan information, see Se
WhenEXPLAINis used with an explainable statement, MySQL displays information from the optimizer about the statement execution plan. That is, MySQL explains how it would process the statement, including information about how tables are joined and in which order. For information about usingEXPLAINto obt...
Second or later SELECT statement in a UNION, dependent on outer query UNION RESULT Result of a UNION. SUBQUERY First SELECT in subquery DEPENDENT SUBQUERY First SELECT in subquery, dependent on outer query DERIVED Derived table UNCACHEABLE SUBQUERY A subquery for which the result cannot be cached...
E:fulltext:全文索引检索,要注意,全文索引的优先级很高,若全文索引和普通索引同时存在时,mysql不管代价,优先选择使用全文索引 F:ref_or_null:与ref方法类似,只是增加了null值的比较。实际用的不多。 例如: SELECT * FROM ref_table WHERE key_column=expr OR key_column IS NULL; G:index_merge:表示查询使用...
| DELETE statement | INSERT statement | REPLACE statement | UPDATE statement 结果解读:id 该语句的唯一标识。如果explain的结果包括多个id值,则数字越大越先执行;而对于相同id的行,则表示从上往下依次执行。select_type 查询类型,有如下几种取值:查询类型作用 table 表示当前这一行正在访问哪张表,如果SQL...
官方文档:MySQL 参考手册 - 15.8.2 EXPLAIN Statement 标准语法: {EXPLAIN | DESCRIBE | DESC} tbl_name [col_name | wild] 1. 2. 返回值类型:Parse_tree_root对象(top_level_node),用于存储最顶层节点,即语句层级节点 Bison 语法如下: describe_stmt: ...
当作用于可解释性的语句(explainable statement)时,其展示相应 SQL 语句被优化后的执行计划(execution plan),也就是 MySQL 会如何处理该 SQL 查询语句,比如有JOIN语句时多表是怎样结合,以怎样的顺序结合。 当作用于FOR CONNECTION connection_id而不是可解释性语句时,其展示的是该连接的执行计划。
SELECT statement | TABLE statement | DELETE statement | INSERT statement | REPLACE statement | UPDATE statement } 示例: EXPLAIN format = TRADITIONAL json SELECT tt.TicketNumber, tt.TimeIn, tt.ProjectReference, tt.EstimatedShipDate, tt.ActualShipDate, tt.ClientID, ...
| UPDATEstatement}用一条简单的sql看看使用explain关键字的效果:explain select * from test1;执行结果: 从上图中看到执行结果中会显示12列信息,每列具体信息如下: 说白了,我们要搞懂这些列的具体含义才能正常判断索引的使用情况。话不多说,直接开始介绍吧。id列该列的值是select查询中的序号,比如:1、2、3、4...
explain是mysql中sql优化的一个重要手段。顾名思义,explain就是解释sql,用于表示sql是怎样执行的信息,即sql执行计划! 语法 explain statement statement包括select/insert/delete/update语句。 explain会对select语句使用到每张表都会返回一行信息。在输出列出的表是按照mysql处理sql时读他们的顺序排序的。mysql使用嵌套循环...