If you notice your WordPress-based website loading time increasing, it may be an indication that the website is overloaded. Finding the causes of the overload can help you better apply actions toward optimization. You can easily have this information at hand using Query Monitor. Just follow these steps:
Step 1 - Install the Query Monitor Plugin
Go to the Plugins → Add New section on your WordPress admin panel and search for Query Monitor. Click on Install Now to install it:
Once installation is complete, click on Activate to enable it.
Step 2 - Set Authentication Cookie
To get information on how your website performs for visitors, you will need to set an authentication cookie. Go to Plugins → Installed Plugins, scroll down to Query Monitor, and click on Settings to open the plugin's settings:
Next, click the Set authentication cookie button:
Step 3 - Check the Query List
Once the authentication cookie is active, you'll see performance details in the WordPress admin bar as follows:
Indicating the following from left to right:
The page loading time in seconds
The peak memory usage in MB
The time taken by database queries in seconds
The database query count
Additional information may appear regarding
Click on the Query Monitor information for more details on the website performance:
Select the Database Queries menu option to display any causes of overload on your website. Adjust the size of the Query Monitor window to show more information if needed.
You can identify which queries take a longer time by checking the Time column on the right side, sorting by longest - just click on the arrow next to Time:
Pay attention to the longest caller, as it will be the most likely cause of website overload.
You can find out more about the different information that Query Monitor provides, as well as how to use it for debugging, on the Query Monitor Official Documentation page.
NOTE
To prevent unnecessary resource usage, it is recommended to deactivate Query Monitor if you no longer need it