Some thoughts on DB Queries
Lately there have been a couple of posts in the WordPress community about DB queries and the amount of calls that are made per page. While that clearly has merit and I’m by no means saying ignore it, there’s been very little focus on the actual DB queries themselves. No offense to anyone, but if you are going to focus on the number of DB calls instead of first optimizing your SQL – then either you know very little about development, or have never built a large scale web application.
So, if you have queries that have any kind of JOIN in them, I would suggest restructuring those as a first port of call. ONLY once you’ve done that should you move onto optimizing the code. I hit a performance related issue this past week and while it ended up having to do with the amount of DB calls, the problem wasn’t the SQL queries in that case but as my general rule of thumb I checked them first. That allowed me to figure out that the problem was in the code.
What do you think about optimization?

