EXPLAIN
Syntax
Or:
EXPLAIN tbl_name
The EXPLAIN
statement can be used either as a way to obtain information about how MariaDB executes a statement, or as a synonym for DESCRIBE
:
- When you precede a statement with the keyword
EXPLAIN
, MariaDB displays information from the optimizer about the statement execution plan. That is, MariaDB explains how it would process the statement, including information about how tables are joined and in which order.EXPLAIN EXTENDED
can be used to provide additional information.As of MariaDB 5.6.3,
EXPLAIN
provides information aboutSELECT
,DELETE
,INSERT
,REPLACE
, andUPDATE
statements. Before MariaDB 5.6.3,EXPLAIN
provides information only aboutSELECT
statements.For information about using
EXPLAIN
andEXPLAIN EXTENDED
to obtain query execution plan information, see , "Optimizing Queries withEXPLAIN
". EXPLAIN PARTITIONS
is useful only when examining queries involving partitioned tables. For details, see , "Obtaining Information About Partitions".- As of MariaDB 5.6.5, the
FORMAT
option can be used to select the output format.TRADITIONAL
presents the output in tabular format. This is the default if noFORMAT
option is present.JSON
format displays the information in JSON format. WithFORMAT = JSON
, the output includes extended and partition information. EXPLAIN
is synonymous withtbl_name
DESCRIBE
ortbl_name
SHOW COLUMNS FROM
. For information abouttbl_name
DESCRIBE
andSHOW COLUMNS
, see , "DESCRIBE
Syntax", and , "SHOW COLUMNS
Syntax".