Benchmark Your Themes

I have been getting deeper into development with WordPress, mostly styling but none the less working in WordPress because the fact of the mater is that there is a market for it. The point of this post is this, building a dynamic site can get quite heave very quickly, especially in WP. If you add a bunch of plug-ins which are loaded dynamically then add a custom theme that you maybe even paid a premium price for, your database queries can go through the roof.

For instance, WP has like 9 queries on an empty page with no plug-ins, that’s a lot already. Now add one of the themes out there with a couple rows of featured posts blocks. One thing that I noticed looking through some of these fancy themes is that they are running a ton of queries to get these featured posts.

Add 3 rows of 3 and a couple plug-ins and you are well over 50 queries.
Now have 100 visitors at a given moment on that page, that is a minimum of 5000 database calls in that moment.
You had better have an excellent host!

I’ve also seen this with dynamic Ajax scroll-er plug-ins.
3 posts to grab content from in one category and its 7-9 queries. Something is not right there, guys.
You should be able to grab that content in 2 queries, 1 if the database structure was descent (but that’s a whole different game).

For you out there with front pages like this, do yourself a favor, especially if you have had issues in the past.
See how many queries are loading and how long it takes, it’s simple to do.

In your theme’s footer.php template before the closing

Add

Now your pages will show you how many queries there are for each page.
You can determine what to do from there.

As a further note on the subject, you can have a featured content page and have a bunch of blocks and not have it take a bunch of database queries.
Stay Tuned and I might tell how 🙂