The Importance of Query Caching and Proper SQL syntax!

by on May 15, 2009

In the past I blogged about using MySQL Qcache and how important it is, for those WPMU admins out there doubting this I HIGHLY advice you to get on this. After enabling the Debug Queries plugin I was more or less shocked at the number of queries some blogs were generating. If Qcache was not being used I am sure our processor would be working beyond overtime. I have seen total queries ranging from a low of 25 to 100+ to get this 823+ on a page, this shows how poorly some plugins and themes are written. This would crush our server if we were not using Query Caching…

For those developing plugins please keep queries consistent:

SELECT * FROM blogs WHERE blog_id = ‘1′
is different from:
select * FROM blogs WHERE blog_id = ‘1′

Both queries will be cached because they are different to MySQL (same goes to white space at the end of a query trim it!!!).