What are the differences between EXPLAIN and DESC commands in MySQL ?
Asked
Active
Viewed 3,443 times
1 Answers
13
- Explain will give you more information about a query,
- describe will give you more information about tables or columns.
You can also use EXPLAIN on a table name, in which case it will behave exactly like DESCRIBE.
EXPLAIN SELECT *
FROM `customer`
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE customer ALL NULL NULL NULL NULL 2
vs.
DESCRIBE `customer`
Field Type Null Key Default Extra
CustomerID varchar(2) NO
Cx varchar(3) NO

Konerak
- 39,272
- 12
- 98
- 118
-
https://dev.mysql.com/doc/refman/8.0/en/explain.html says "The DESCRIBE and EXPLAIN statements are synonyms." And "the MySQL parser treats them as completely synonymous." – palapapa Apr 11 '23 at 07:43