How many queries per page is enough?

[ad_1]

Currently my homepage has `50Q` and query time is around `0.0170s`. Those queries are small and called multiple time in a loop. I plan to make a big query return an object-like array. But I read it on stackoverflow that it would cause more trouble in performance than many small queries.

For more detail about `50Q`, it was `32Q` from my theme and `16Q` from core. I already tried to minimize the core query but still have no idea where those coming from.

Here are reports of my site consumed in once request:

“`
# Request to homepage that has
– 1 header, 5 sections, 1 footer
– 1 custom CPT WP_Query limit to 10 posts
– lots of ACF fields being called by native WP functions
– 1 contact-form-7

# At best request
Page Generation Time: 0.2628s – 0.4% of 60s limit
Peak Memory Usage: 4,980,448 bytes (4.7 MB) – 0.5% of 1,024 MB server limit
Database Queries: 0.0141s (total 50Q)

# At worst request
Page Generation Time: 0.3184s – 0.5% of 60s limit
Peak Memory Usage: 4,980,448 bytes (4.7 MB) – 0.5% of 1,024 MB server limit
Database Queries: 0.0200s (50Q)
“`

All the observations were done in my localhost so… it works in my machine :p

Anyway, do you think this is bad for a homepage? The themes Twenty Seventeen & Twenty Twenty have much better performance reports which makes me kinda jealous.

Also, can you share your experience on this? Like the biggest/smallest query count you’ve seen, the performance speed, ram, etc.

[ad_2]
1 Comment
  1. Why don’t you implement that “big query” and see how it affects the performance of your site. I mean, I regularly see homepages with ~300-500 queries but it is of little significance because the page is heavily cached.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer