2011-07-30Getting a MySQL Execution Plan
Put EXPLAIN in front of an SQL statement to retrieve the execution plan.
EXPLAIN SELECT 1;
The plan is shown in tabular form (some less important columns removed):
~+-------+------+---------------+------+~+------+------------~ ~| table | type | possible_keys | key |~| rows | Extra ~+-------+------+---------------+------+~+------+------------~ ~| NULL | NULL | NULL | NULL |~| NULL | No tables... ~+-------+------+---------------+------+~+------+------------~
The most important information is in the TYPE column. Although the MySQL documentation refers to it as "join type", I prefer the expression "access type" because it actually specifies how the data is accessed. The meaning of the type values are described in the next section.
share and subscribe
RSS FeedFlattr this! Follow me on TwitterShare at Google+Like on Facebook