When it comes to basic query optimization and analysis, in my opinion, there is no better tool than the MySQL EXPLAIN command. It can prove to be an invaluable tool for deciphering the MySQL query execution plan, or the way that MySQL is optimizing and executing the query. It will show you the type of SELECT being made on the table, the join type, possible keys, used keys, rows analyzed and more. I won’t get into the nitty gritty of EXPLAIN in this post, but if you are using it, on occasion you may get the following output:

+-----------------------------------------------------+
| Extra                                               |
+-----------------------------------------------------+
| Impossible WHERE noticed after reading const tables |
+-----------------------------------------------------+

Read the rest of this entry »