GrabPERF: Why EXPLAIN is such a useful SQL tool

Now, EXPLAIN seems like such an old school SQL tool. Well, I am here to explain why it’s not something you should ignore.
The Index Chart queries were all doing table scans. This can be pretty painful; ok, this can be stupid and EXTREMELY painful. The cause: I was setting sub-optimal date ranges on my queries and making all kinds of crazy date_format calls to format the dates IN THE QUERIES.
Once I changed the code, even when the query cache is cleared, the Index Charts now all run at less than 1 second.
Colour me stupid.

Leave a Reply

Your email address will not be published. Required fields are marked *