Skip to main content
EXPLAIN shows the logical or physical execution plans for a query statement. For instructions on how to analyze a query plan, refer to Plan analysis. Tip This operation does not require privileges.

Syntax

Tip The level of execution plan detail returned: EXPLAIN LOGICAL < EXPLAIN < EXPLAIN VERBOSE < EXPLAIN COSTS. If no level is specified, EXPLAIN returns the plan at the default level. From v3.5.11, v4.0.4, and v4.1.0 onwards, you can configure this default level using the dynamic FE parameter query_explain_level (default: NORMAL, that is, the level of EXPLAIN in the order above). In v3.5.10, v4.0.2, and v4.0.3, the default level follows the dynamic FE parameter query_detail_explain_level (default: COSTS). In other versions, the default level cannot be changed. In most cases, using EXPLAIN is sufficient. EXPLAIN VERBOSE and EXPLAIN COSTS will print a lot of internal information, which is mainly used for debugging the execution plan.

Parameters

NOTE The dynamic FE parameter query_detail_explain_level controls the level of the execution plan recorded in query details, not the level returned by EXPLAIN (except in v3.5.10, v4.0.2, and v4.0.3).

Return value

Returns the execution plan of the input query statement.

Examples

EXPLAIN

EXPLAIN LOGICAL

EXPLAIN VERBOSE

EXPLAIN COSTS