Skip to content

Using Query Monitor for Your Database Performance Optimization

The topics of SQL and database performance optimization are important to a small percentage of WordPress sites. But when they matter, they matter a whole heck of a lot. It is in those situations that the WordPress plugin Query Monitor comes in. Maintained by John Blackbourn, Query Monitor is a great way to see what database queries were run on specific page of your site, and find out what the slow ones are. Once you find that, you’ve still got some work to do—tracking down the problematic query’s source, fixing the code that produced the query, etc—and unfortunately that work is far outside the scope of this little Quick Guide. All that said, let’s cover the basics of how to start to understand what’s going on with the WordPress Query Monitor plugin.

Video Guide to Getting Started with Query Monitor for WordPress

As mentioned, we can’t cover the whole of SQL optimization in this Quick Guide, but here’s the start of the process using Query Monitor:

Basics of Installing and Using Query Monitor for WordPress

  1. Like every new plugin installation, you’ll want to navigate the administration area of your WordPress site to the “Plugins > Add New” page you can find in the left-sidebar. Once there, you’ll do a search for the “Query Monitor” plugin.
  2. On the “Query Monitor” plugin you’ll want to hit the “Install” button. After WordPress downloads and installs the plugin, you’ll want to also hit “Activate.”
  3. At this point, the plugin is totally ready to use. To see results, you’ll want to navigate to a specific page (while logged in as an Administrator of your WordPress site) and look in the Admin bar on that page. You’ll see a big block toward the middle that probably looks like a random assortment of numbers and letters. Mine is pictured at right. This is from the Query Monitor plugin working in the background as you load the page. You’ll notice that not only can you click through from that hover-menu to see what database/SQL queries were run to build the page, but you can also see a WHOLE LOT MORE. If you’re a developer, this is freaking awesome. If you’re not, this is probably where you decide Query Monitor isn’t for you ;p (no judgement either way ❤️)
  4. If QM is for you, you’ll probably have wanted to install Query Monitor to find out why a specific WordPress page is slow. Truly really getting to the root of that is beyond the scope of this article (or really anything other than an “SQL for WordPress” course, which if you’re interested in sound off in the comments). But to get started you’ll want to click on “Queries” from the dropdown menu. That’ll bring up a view (sort of like your browser’s “Web Inspector”) at the bottom of the page with all the database queries WordPress used to build the current page for you, and how long they took to complete.

Once you’ve seen the results of Query Monitor, you’re outside of what I think reasonable to cover here. The Query Monitor plugin itself would be the great basis of a whole little mini-course about what all you’re seeing means (again, sound off in the comments if that interests you), but for now just realize how freaking powerful and cool this is! Best of luck 🙂

Yay! 🎉 You made it to the end of the article!
David Hayes

0 Comments
Inline Feedbacks
View all comments

Or start the conversation in our Facebook group for WordPress professionals. Find answers, share tips, and get help from other WordPress experts. Join now (it’s free)!

0
Would love your thoughts, please comment.x

Most Searched Articles

Best JavaScript Libraries and Frameworks: Try These 14 in 2024

In this post, we look at the best JavaScript libraries and frameworks to try out this year. Why? Well, with JavaScript being available in every web browser, this makes it the most accessible programming language of ...

20 Best Free WordPress Themes for 2024 (Responsive, Mobile-Ready, Beautiful)

If you're looking for only the best free WordPress themes in the market for this year, then you're in the right place. We have more than enough such themes for you right ...

12 Best WordPress Hosting Providers of 2024 Compared and Tested

Looking for the best WordPress hosting that you can actually afford? We did the testing for you. Here are 10+ best hosts on the market ...

Handpicked Articles

How to Make a WordPress Website: Ultimate Guide for All Users – Beginners, Intermediate, Advanced

Many people wonder how to make a WordPress website. They’ve heard about WordPress, its incredible popularity, excellent features and designs, and now they want to join the pack and build a WordPress website of their own. So, where does one get ...

How to Start an Ecommerce Business: Ultimate Guide for 2024

Is this going to be the year you learn how to start an eCommerce business from scratch? You’re certainly in the right place! This guide will give you a roadmap to getting from 0 to a fully functional eCommerce business. ...