In MySQL we can use the EXPLAIN
statement to get information about SQL queries that we run against the database. We can also get information about tables and views.
EXPLAIN
is a synonym for DESCRIBE
(and its short form DESC
). Even though these statements all work exactly the same, there’s a common convention amongst MySQL developers to use DESCRIBE
for certain tasks and EXPLAIN
for others. Typically, DESCRIBE
is often used to get information about tables and views, whereas EXPLAIN
is used to get information about queries, such as query execution plans.