Skip to content

How to use

John Blackbourn edited this page Jul 16, 2019 · 15 revisions

Installation

Install and activate Query Monitor as you would any other WordPress plugin. You can download it here on WordPress.org.

Usage

While you're logged in as an Administrator you'll see a new menu item in the admin toolbar menu:

Admin Toolbar Menu

The numbers at the top show, in order:

  1. Page generation time
  2. Total memory usage
  3. Total time taken by SQL queries
  4. Total number of SQL queries

Click the top of the menu to open the Overview panel, or click any menu item to open its corresponding panel.

Initially you'll probably be most interested in the Queries panel, which shows all of the database queries that were performed during the page load, and allows you to filter and sort them and determine which component was responsible for each query.

Debugging a Slow Site

So your site is slow and you've decided to install Query Monitor in order to identify the cause. There are a few panels that you should look at first.

1. Queries by Component

The Queries -> Queries by Component panel shows you aggregate information about the database queries that were executed by each plugin and theme during the page load. This is a good way to quickly identify a poorly performing theme or plugins.

This panel is sorted by the total time taken for all the queries executed by each component. A plugin that performs a high number of queries, or performs queries that are slow, will contribute to the time that your site takes to load.

2. HTTP API Calls

The HTTP API Calls panel shows you information about the server-side HTTP requests that were performed during the page load. These are usually "invisible" causes of a slow site, and can occur sporadically.

If a plugin or theme regularly triggers an HTTP API call during the loading of a page, this will cause it to increase the time that your site takes to load.

3. PHP Errors

The PHP Errors panel will appear only if some code that executed during the loading of the page caused a PHP error, such as a notice or a warning. If you see a red or orange highlight in Query Monitor's admin toolbar menu, this means an error occurred during the loading of the page and you should investigate it.

Code that triggers a Warning means the code is not operating as expected, and may be causing broken behaviour on your site and can contribute to an increase in the time that your site takes to load because each error needs to be logged by your server.

Code that triggers a Notice is less critical but should still be investigated as it can be indicative of poorly written code. Notices may or may not be logged by your server depending on its configuration, so they may or may not be slowing down your site.

Everything Else

Despite its name, Query Monitor includes a large amount of functionality unrelated to database queries. For example, in the Request panel you can see information about rewrite rules and query variables; in the Template panel you can see information about the theme template hierarchy and template parts; and in the Scripts and Styles panels you can see information about the JavaScript and CSS dependencies on the page.

Click through each of the panels and hopefully you'll find something interesting!

Clone this wiki locally