ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Question About Number of Queries

September 27, 2008 6:35pm

Subscribe [1]
  • #1 / Sep 27, 2008 6:35pm

    Ceil

    65 posts

    I have been optimizing my site, using tech support messages in the forum—replies that you folks have sent me here in the tech support forum and that you sent to others, as well.

    And I used all the suggestions in the wiki.

    One suggestion I read was to try and reduce embed tags, to help reduce queries, and to use as few queries as possible.

    My website is very “graphical” in that all my content is inside a 3D radio graphic, which is sliced/diced into many little pieces.

    To make changes to the top and bottom button bars easier, as well as changes to the branding at the top of the radio, I took the 4 rows of sliced graphics at the top and the 4 at the bottom and created a separate template for each of them, keeping all 8 row/templates in a template group called “radio.” I call to them with the embed tag between the beginning and ending TR tags on each page.

    I just experimented with comparing these templates with 2 additional, experimental ones that I created that do not have the embed tags; instead, they contain the TD tags and all the image tags within them.

    The number of queries for one of these 2 experimental pages was reduced from 25-32 (different on each visit) to 13. On the other experimental page, queries used to display the page were reduced from 22 to 14. Is that a significant reduction? Is it worth changing the code for this number of queries and losing the convenience I get by calling to those rows with an embed tag?

    Also, pardon my lack of knowledge, but why do some of my pages always require the same number of queries to display them, and other pages require a different number of queries each time I visit those pages? Is it because the fluctuating ones have weblogs? (That seems to be the thing that makes them fluctuate, but I can’t tell.) What causes the number of queries necessary to display a page to fluctuate?

    Thanks so much!

    -Ceil

  • #2 / Sep 28, 2008 10:46am

    Robin Sowell

    13255 posts

    This is really a judgement call question.  And keep in mind- not all queries are created equal.  The more complex the query- the more table joins, etc- the more resources/slow it will be.  It’s possible 3 queries will be faster/more efficient than one query- depending on the queries.

    So- as long as the site is responding speedily- and use the {elapsed_time} global and template debugging to see how fast EE is handling its end of things.  25-30 queries is really very good, imo.  I’d expect things to be nice and speedy and as long as it is- I doubt I’d spend too much time tweaking it beyond that.  (Unless it’s out of curiosity, for practice, etc.)  I wouldn’t make development/maintenance more difficult in order to cut down from that number- not unless there was some lag going on.  And if it is lagging, queries wouldn’t be my first place to look given you’re in the 20-30 range.

    Oh- and there can be a lot of reasons for the number of queries fluctuating a bit.  The biggest is probably caching of some sort.

    That help?

  • #3 / Sep 28, 2008 1:30pm

    Ceil

    65 posts

    Yes, Robin; this is what I needed to know.

    Thanks so much!

    -Ceil

  • #4 / Sep 28, 2008 1:45pm

    Robin Sowell

    13255 posts

    Good deal!  😉

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases