WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#13085 closed defect (bug) (fixed)

Twenty Ten makes too many queries for index pages

Reported by: demetris Owned by:
Milestone: 3.0 Priority: normal
Severity: major Version: 3.0
Component: Performance Keywords:
Focuses: Cc:

Description

The testing environment is nothing fancy or excessive:

  • Current trunk (r14186)
  • Default widgets (Search, Categories, Meta)
  • Four plugins (Markdown Extra, SQL Monitor, WP Console, WP-Syntax)
  • Ten (10) posts per index page

In that humble setup, Twenty Ten makes thirty-four (34) queries to put together the home page, archive pages, etc.

(If I replace wp_nav_menu with wp_page_menu, the number goes down to 31.)

For reference, the Hybrid theme (with the same widgets) needs 11 queries for the same job. Kubrick, if I remember correctly, used something in that area too, 10 or 11 queries.

I only have the vaguest idea of where this might be coming from, so I’ll leave the diagnosis to the experts, but over 30 queries for index pages in a default install seems too much to me.

Change History (8)

comment:1 @aaroncampbell5 years ago

  • Cc aaron@… added

comment:2 @dd325 years ago

I can top you with 62 queries for my front page.

Most of the queries are related to Taxonomy data loading. What we'd benefit from here is a mass-loading query, something which loads all the taxonomy data for a set of post_id's into the memory cache with a single query.

I think there are some functions which are also skipping potential cached data, as i'm seeing a few queries repeated (some by function1, which calls function2, which then makes the same query)

comment:3 @optimiced5 years ago

WP 2.9.2 stable with Default Kubrick Theme uses more than 10-11 queries for the home (index) page, in my experience. Even if no plugins are used. I think queries are more than 20, in fact...

Still, over 30 for WP 3 and new default theme seems a bit too much, maybe...

comment:4 @beaulebens5 years ago

From a quick exploration of the taxonomy code, it looks like results are cached, but the cache is never checked in functions like wp_get_object_terms(). Looking at a decent way to remedy this now.

comment:5 @demetris5 years ago

The removal of Twenty Ten’s custom taxonomy functions in r14384 brings the queries for index pages from 34 down to 12. So, issue fixed for Twenty Ten.

Since beaulebens is looking at the more general issue, I’m leaving the ticket open for now.

comment:6 @nacin5 years ago

The other issue is menus, but we'll be handling that elsewhere (hopefully).

comment:7 @demetris5 years ago

  • Resolution set to fixed
  • Status changed from new to closed

Closing this one as fixed then.

comment:8 @nacin5 years ago

Is there another ticket for beaulebens to work in?

Note: See TracTickets for help on using tickets.