EXPLAIN [ ( option [, ...] ) ] statement EXPLAIN [ ANALYZE ] [ VERBOSE ] statement 常用参数: ANALYZE [ boolean ] --- 默认FALSE。通过实际执行SQL获得SQL命令的实际执行计划 VERBOSE [ boolean ] --- 默认FALSE。显示计划的附加信息 COSTS [ boolean ] --- 默认TRUE。显示每个计划节点的启动成本和...
| UPDATE statement } 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 用一条简单的sql看看使用explain关键字的效果: explain select * from test1; 1. 执行结果: 从上图中看到执行结果中会显示12列信息,每列具体信息如下: 说白...
{EXPLAIN | DESCRIBE | DESC} tbl_name [col_name | wild] {EXPLAIN | DESCRIBE | DESC} [explain_type] {explainable_stmt | FORCONNECTION connection_id} explain_type: { EXTENDED | PARTITIONS | FORMAT = format_name } format_name: { TRADITIONAL | JSON } explainable_stmt: { SELECTstatement | ...
deptno in (select d.deptno from dept d where d.dname = 'SALES'); select_type 用于分辨查询类型,比如普通查询,连表查询等。官网的解释如下: select_type Value Meaning SIMPLE Simple SELECT (not using UNION or subqueries) PRIMARY Outermost SELECT UNION Second or later SELECT statement in a UNION...
When EXPLAIN is used with FOR CONNECTION connection_id rather than an explainable statement, it displays the execution plan for the statement executing in the named connection. See Section 8.8.4, “Obtaining Execution Plan Information for a Named Connection”. 当EXPLAIN与FOR CONNECTION connection_id...
SelectStatement|||IMCI Execution Plan (max_dop=4, max_query_mem=858993459)||2|└─Sort|||Sort Key: revenueDESC,o_orderdateASC||3|└─Hash Groupby|||GroupKey: (lineitem.L_ORDERKEY, orders.O_ORDERDATE, orders.O_SHIPPRIORITY)||4|└─HashJoin|||JoinCond: orders.O_ORDERKEY=lineitem.L...
在优化sql语句时,我们经常会用到explain语句,这里对explain语句做一个详细的总结说明。 The EXPLAIN statement provides information about how MySQL executes statements. EXPLAIN works with SELECT, DELETE, INSERT, REPLACE, and UPDATE statements. 通过一个实例来说明explain的用法,其实使用很简单,主要是通过实例来介...
EXPLAIN ANALYZE [ (option[, ...]) ]statement option可為下列項目之一: FORMAT{TEXT|JSON } 如果未指定FORMAT選項,則輸出預設為TEXT格式。因為EXPLAIN ANALYZE的所有查詢為DISTRIBUTED,則TYPE選項不可為EXPLAIN ANALYZE。 陳述式可為下列其中之一: SELECT CREATE TABLE AS SELECT INSERT UNLOAD ...
explain select * from emp e where e.deptno in (select d.deptno from dept d where d.dname = 'SALES'); select_type 用于分辨查询类型,比如普通查询,连表查询等。官网的解释如下: 上面的解释你肯定看的云里雾里的,我们实际来写SQL看看每种出现的情景。
explain可用来分析SQL的执行计划。格式如下:{EXPLAIN | DESCRIBE | DESC} tbl_name [col_name | wild][explain_type]{explainable_stmt | FOR CONNECTION connection_id} {EXPLAIN | DESCRIBE | DESC} ANALYZE select_statement explain_type: { FORMAT = format_name } format_name: { TRADITIONAL | JSON...