Update: As some people have pointed out, if this is on all the time in a production environment, it could be bad. We only enable it when debugging. But, in the interest of keeping the PHP world safe, I have edited the code.
Preface: I would not use this in a production environment on a full time basis. When we do use it, we turn it on, gather some logs and turn it off. Also, it has been pointed out to me that this will cause MySQL to not use the query cache in versions previous to 5.0. That is another reason to not use this in a production environment full time.
So, on dealnews.com we often end up with a lot of queries that look kind of the same. It usually because we have a complex query that simply selects article ids from one or two tables and then a second query to select the data from the article table using those ids. If you have used MySQL …
[Read more]