Query Loop Spiking CPU?

I ran into an issue where editing the homepage would spike CPU to 6.0. I have a feeling it’s Query Block using up php resources?

Web host has tested on their end by disabling all plugins and themes and also came to the conclusion that GB is causing the cpu spike.

For what it’s worth, when adding a Parameter of “Include Posts” inside Query Loop also show the thinking process. Sometimes all posts will lost and sometimes the loading is endless. I noticed another user posted this issue on another thread. I wonder if it’s a server resource issue.

Editing a homepage with 3 Query Blocks is causing this spike. Do you think this is the cause and how can we try and resolve this?



The Query Loop block uses the core WP_Query feature: WP_Query | Class | WordPress Developer Resources

Having three queries on a page definitely shouldn’t create a CPU spike. It could be a combination of your query parameters, or even a combination of them and another plugin.

You’ll need to debug by removing other plugins/tweaking your query parameters to try to find the offending configuration.

Thanks for chiming in. The web host disabled all plugins and diagnosed it was GB. I think they saw 10 dB calls or something from those Query Loops I presume. The site does have over 1000 posts so maybe having to sift through and pull from there is too much for this server type. It more than likely is the web host limiting resources as well.

Some WP_Query args will definitely be more resource-intensive than others, especially if there are a lot of posts.

You can always test by adding your own custom WP_Query functions to a shortcode or custom template to see if it’s something within the args (completely separate to GB).