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 EXTENDEDcan be used to provide additional information.As of MariaDB 5.6.3,
EXPLAINprovides information aboutSELECT,DELETE,INSERT,REPLACE, andUPDATEstatements. Before MariaDB 5.6.3,EXPLAINprovides information only aboutSELECTstatements.For information about using
EXPLAINandEXPLAIN EXTENDEDto obtain query execution plan information, see , "Optimizing Queries withEXPLAIN". EXPLAIN PARTITIONSis useful only when examining queries involving partitioned tables. For details, see , "Obtaining Information About Partitions".- As of MariaDB 5.6.5, the
FORMAToption can be used to select the output format.TRADITIONALpresents the output in tabular format. This is the default if noFORMAToption is present.JSONformat displays the information in JSON format. WithFORMAT = JSON, the output includes extended and partition information. EXPLAINis synonymous withtbl_nameDESCRIBEortbl_nameSHOW COLUMNS FROM. For information abouttbl_nameDESCRIBEandSHOW COLUMNS, see , "DESCRIBESyntax", and , "SHOW COLUMNSSyntax".