EXPLAIN [EXTENDED | PARTITIONS] SELECT select_options
Or:
EXPLAIN tbl_name
The EXPLAIN statement can be used
either as a way to obtain information about how MySQL executes a
SELECT statement or as a synonym
for DESCRIBE:
When you precede a
SELECTstatement with the keywordEXPLAIN, MySQL displays information from the optimizer about the query execution plan. That is, MySQL explains how it would process theSELECT, including information about how tables are joined and in which order.EXPLAIN EXTENDEDcan be used to provide additional information.For information on how to use
EXPLAINandEXPLAIN EXTENDEDto obtain query execution plan information, see Section 7.8.1, “Optimizing Queries withEXPLAIN”.EXPLAIN PARTITIONSis useful only when examining queries involving partitioned tables. For details, see Section 18.3.4, “Obtaining Information About Partitions”.EXPLAINis synonymous withtbl_nameDESCRIBEortbl_nameSHOW COLUMNS FROM.tbl_nameFor a description of the
DESCRIBEandSHOW COLUMNSstatements, see Section 12.8.1, “DESCRIBESyntax”, and Section 12.4.5.6, “SHOW COLUMNSSyntax”.