0

How many queries on a page would be considered too many and should be looked into?

I site I am currently working on has about 20 - 30 queries per page.

Is that pretty good or do I need to to look into lowering that number?

Just not sure what is average or typical.

Thanks.

1
  • It is useful to give some indication of your EE environment in a question - helps people give you better answers - e.g. version of EE you are using, php version, and kind of hosting you are using. Commented May 15, 2019 at 14:38

3 Answers 3

2

Although in general it is good practice to find ways to minimise the number of queries on a page, it probably doesn't matter too much: what is more important is getting the information you need on the page with a level of performance that meets your site's requirements. Also remember that EE is running loads of queries in the background to process your template tags, so the amount of effort is not just limited to the number of queries you run yourself. As a guide a data intensive page (multiple layouts and embeds) on a site I maintain requires about 200 queries to build.

If you think your loading times are too long, then the EE built in debug tools provide useful information about the overall amount of time and effort a page requires to put onscreen. You can speed up most sites using a combination of its caching tools and its template layout system, plus if you have the time / resources it plays nicely with other caching technologies as required.

HTH

1
  • Thanks! I appreciate the info.
    – mediapimp
    Commented May 15, 2019 at 21:46
2

The number of queries isn't normally that important, it's the page loading times you need to watch. Saying that if you're reaching several hundred or thousand queries per page it's worth looking to see what's causing it and optimising where you can.

Personally I try to keep queries below 100/200 per page before caching, after caching below 50 where possible.

1
  • Thanks! I appreciate the info.
    – mediapimp
    Commented May 15, 2019 at 21:46
0

If you use the developer tools for your browser, e.g., Chrome's (Ctrl + Shift + i), then go to the Network tab, then refresh your page, you'll see your page's load time, isolated from other elements. If that is too high (I'd say 1+ second), I'd look at your database calls. Sometimes there's an obvious big one, but other times you can do all the tweaking/simplifying possible, such as with the disable parameter. Or you could simply use cache, particularly page caching.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.