car-race-438467_1280

Query Monitor

One of the biggest tasks you’ll run in to with any dynamic┬ásite will be reducing page load times. PHP functions and database calls all take time. Errors in the code will even affect how quickly your site loads. The problem is in finding where your bottlenecks are.

This is where the Query Monitor plugin shines. There are other plugins that are built to do similar things, but none of them seem to do it as well and as comprehensively as Query Monitor.

How it works is it takes a look at every query being run, every hook that’s set, and more, and gives you a report that’s easy to understand and shows how long it took for each query to run. No longer is optimization complete guesswork and just tied to deactivating plugins until your site is fast again.

Getting A Quick Overview

On every page where you see the admin bar you’ll get a nice little overview of what’s going on on the page.

Query Monitor overview

 

If you want to get a more comprehensive breakdown all you need to do is hover over that box.

query-monitor-dropdown

 

If you have any issues on the page you’ll get different colors. For instance if you have any queries that take too long to run you’ll see some red in there.

Digging In To Query Monitor

The area I’ve found most helpful in diagnosing issues has been Queries by Caller. This shows you where your queries are originating from and you can optimize from there.

I also really like that HTTP Requests will show you requests that are timing out. If you’re making a request to a remote site and it goes down that will slow your site down, but you would never know why and you could be banging your head against your desk for hours trying to figure it out.

If you add plugins you might see that there are some PHP errors. Any error will slow your site down. We’re talking milliseconds in most cases, but I have seen sites with over 1000 errors before because of older plugins and just fixing those sped up page load time by about 3 seconds (15%). That’s not insignificant.

Query Monitor will show you what all of the errors are and which file they are in making it very easy to fix them.

Query Monitor showing PHP errors

 

If I wanted to I could then go through and fix all of those errors. The problem with that is if they are in downloaded plugins or themes any time they get updated the errors can come back.

You could always fix them and submit those code changes to the developer so they can be integrated into the code base (contributing to open source projects is awesome). Or if you’re developing your own plugins or themes you can use this feature to find things in your code that need updating. I find it’s cleaner than turning debug on from wp-config.php.

Leave a Reply