[Solved] explain command in mysql


Basically explain is used to give you information regarding how the database goes about getting data using a query you specified. Typically you would use it if you have a slow query that you want to analyze.

As far as I know, explains really only apply to statements that are doing data retrieval. So, assuming the table in your create statement exists, a better example would be…

explain select * from user where user="steve"

What you’ll get back from this is a table containing some information on how the data was retrieved, not the data itself. In the real world you would probably only use explains with much more complicated queries.

You should try Googling “mysql explain”, it turns up some pretty good results that explain the data you will get back when you run an explain query. For example, the information here seems pretty good.

solved explain command in mysql