#6746 closed defect (bug) (fixed)
can't we cache _get_post_ancestors()?
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | 2.5.1 | Priority: | normal |
Severity: | normal | Version: | 2.5 |
Component: | Optimization | Keywords: | |
Focuses: | Cc: |
Description
It seems there's a reason for not doing so, but when your site has a hundred static pages, displaying the pages widget readily takes a second or more...
Attachments (1)
Change History (7)
#2
@
17 years ago
further investigation leads me to identify get_permalink() as the likely culprit for the insane number of queries.
brings me to a thought: isn't reasonable to assume that, if at one point another a page gets queried, there's a 99% change that get_permalink() will get called? if so, it would make sense to get all the ancestors and their details whenever they're not in the cache already.
D.
#3
@
17 years ago
I've attached a patch that adds object caching to get_permalink. Does that help reduce the queries?
Note: See
TracTickets for help on using
tickets.
figures for a site with 90 static pages:
@ init hook: 7 queries - 0.160 seconds
@ template_redirect hook: 11 queries - 0.183 seconds
@ wp_footer hook: 153 queries - 0.403 seconds
the 153 queries (almost all related to _get_post_ancestors()) take as much as a second every now and then...