The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Databases
> MySQL Help
|
What can we learn from EXPLAIN SELECT?
Discuss What can we learn from EXPLAIN SELECT? in the MySQL Help forum on Dev Shed. What can we learn from EXPLAIN SELECT? MySQL Help forum discussing administration, SQL syntax, and other MySQL-related topics. MySQL is an open-source relational database management system (RDBMS).
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

June 27th, 2012, 07:48 PM
|
 |
A Change of Season
|
|
|
|
|
What can we learn from EXPLAIN SELECT?
By looking at this
1 - Can we tell that the query is well optimized as the select types are all "simple"? If not what the main purpose of information in this column?
2 - What do we learn from "rows" column? Is 1795 too many rows? If so how do we know how we can minimize it?
3 - What is the benefits of information in "possible_keys" and "Extra" columns?
__________________
Devshed people, please fix the spell check:
System is temporarily busy. Please try again in a few seconds.
Last edited by zxcvbnm : June 27th, 2012 at 08:00 PM.
|

June 28th, 2012, 02:53 AM
|
 |
Lord of the Dance
|
|
|
|
|
It would help if you also posted your tables structure and query.
One thing that is not good is "using filesort".
The field 'Possible Index' can give you an hint on which of the fields it could benefit to have an index added.
|

June 28th, 2012, 04:09 AM
|
 |
SQL Consultant
|
|
Join Date: Feb 2003
Location: Toronto Canada
|
|
Quote: | Originally Posted by MrFujin The field 'Possible Index' can give you an hint on which of the fields it could benefit to have an index added. | nope, but good guess
"possible_keys" lists all the indexes that it looked at that might help optimize this query, and "key" is the one it chose
|

June 29th, 2012, 01:55 AM
|
 |
A Change of Season
|
|
|
|
|
By looking at explain can you tell why this query takes a long time to load?
|

June 29th, 2012, 04:29 AM
|
 |
Lord of the Dance
|
|
|
|
Will it be possible of you to post following information:
- table(s) structure
- query
- the actual time it takes
- number of total rows
@r937
Ah well, but thanks for the explanation. Always nice to learn something new. 
|

July 1st, 2012, 07:09 PM
|
 |
A Change of Season
|
|
|
|
I appreciate the posts Fujin and Rudy but your posts are not answering any of my questions
Quote: By looking at this
1 - Can we tell that the query is well optimized as the select types are all "simple"? If not what the main purpose of information in this column?
2 - What do we learn from "rows" column? Is 1795 too many rows? If so how do we know how we can minimize it?
3 - What is the benefits of information in "possible_keys" and "Extra" columns? |
|

July 1st, 2012, 10:04 PM
|
 |
SQL Consultant
|
|
Join Date: Feb 2003
Location: Toronto Canada
|
|
|
1. not necessarily
yes, you want SIMPLE, but i've never seen anything else
2. 1795 is not "too many" if that's how many meet the query criteria!!
3. possible_keys tells you whether there are any indexes that help improve performance beyond the slow-as-cold-glue table scan (the index it chooses is in the key column)
extra is the most important column, it will tell you when a sort is being done (sorts are very expensive)
by the way, analyzing an EXPLAIN out of context, with no idea of what the query is asking for or what tables look like, is largely guesswork
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|