MySQL EXPLAIN Cheatsheet
MySQL EXPLAIN Cheatsheet
SELECT_TYPE
SIMPLE One table orJOINs
EXTRA
Distinct Stops after first row match
PRIMARY First SELECT in a UNION / outer query in a
subquery Full scan on No index lookup on subquery
NULL key
UNION Second and later SELECTs in a UNION
Impossible WHERE clause always false
DEPENDENT UNION Second and later SELECTs in a UNION, WHERE noticed
dependent on outer query after reading
consts tables
UNION RESULT Result of a UNION
No tables No FROM or FROM DUAL
SUBQUERY First SELECT in a subquery
Not exists Stops after first row match for each row set from previous tables
DEPENDENT SUBQUERY First SELECT in a subquery, dependent on outer
query; re-evaluated for each different variable Range checked No good index; there might be one after values from previous
for each tables are known
set from outer context record (index
DERIVED Derived table — SELECT subquery in FROM map: N)
clause Select tables Aggregate functions resolved by index or metadata
UNCACHEABLE SUBQUERY Result of subquery cannot be cached, must optimized
away
be re-evaluated for each outer query row
Using (...) filesort Extra pass through data for sort
index Uses index only, no table read
index for GROUP BY or DISTINCT resolved by index or
group-by metadata
intersection uses index_merge join type
sort_union uses index_merge join type
temporary Temporary table used
union uses index_merge join type
where WHERE clause exists
where with NDB Cluster only; pushes condition to data
www.pythian.com
2008-04-11, v4