There’s an extremely useful feature in Wordpress that the more observant of you may have noticed I use. If you look to the bottom of the page, you’ll notice that there’s a line that might read something like:
35 queries. 2.255 seconds.
That’s a quick report of exactly how many MySQL queries are executed and how long it took to execute them. If you’re running a Wordpress blog this is one of the single biggest things that will impact load time for your users. All you need to do add the following code in wherever you want to see (or not see it).
< ?php echo get_num_queries(); ?> queries.
< ?php timer_stop(1); ?> seconds.
It’s just that simple. While there are some things that you’re not going to be able to control in terms of the query count, your plugins may have a significant impact on just how many queries you’re running on a particular page. Try the page with the plugin on, get a count, try with the plugin off, get another count. It’s another vital piece of information you need in order to make an educated decision as to whether or not you want to use a particular plugin.
This information is also going to help you out if you go dive into improvements on the database side of things. There are a lot of possibilities when it comes to database optimizations but they may not all have a direct effect on your blog. With this simple chunk of code in there, you’ll know for sure.
So consider tossing this into your template. Even if it’s written out in a non-visible manner so that you can check out the source code to get your data.
Wordpress
