Explain Vs Desc anomalies in mysql
Asked Answered
R

1

11

What are the differences between EXPLAIN and DESC commands in MySQL ?

Rhapsodist answered 23/6, 2010 at 8:58 Comment(0)
C
14
  • 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   
Crashing answered 23/6, 2010 at 9:2 Comment(1)
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."Vaivode

© 2022 - 2024 — McMap. All rights reserved.