Make WordPress Core

Opened 13 years ago

Closed 11 years ago

Last modified 11 years ago

#16621 closed enhancement (maybelater)

Check term cache in _transform_terms()

Reported by: misterbisson's profile misterbisson Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.1
Component: Taxonomy Keywords:
Focuses: Cc:

Description

WP3.1's awesome new taxonomy query stuff rocks, but WP_Tax_Query->_transform_terms() seems to be executing multiple identical queries on each page load. The front page of one of my sites gives me five of the following query:

SELECT wp_1_term_taxonomy.term_taxonomy_id
FROM wp_1_term_taxonomy
INNER JOIN wp_1_terms USING (term_id)
WHERE taxonomy = 'channel'
AND wp_1_terms.slug IN ('tech')

I understand the function can do a lot more than map a single term+taxonomy to a term_taxonomy_id, but it also looks like there'd be some performance benefit from checking the term cache rather than the DB in those situations.

Or, perhaps it'd be enough to simply cache the result for the duration of the page load.

Or, maybe I'm focusing on the wrong problem, as the query takes just 1-2ms to execute.

Change History (5)

#1 @scribu
13 years ago

The trouble is that we can't retrieve cached terms by slug, only by term id.

I guess we could still check the cache when transforming from a term id.

#2 @misterbisson
13 years ago

@Scribu: sorry, you're right. I had been certain that WP maintained a cache addressable by term slug. I was wrong and probably guilty of wishful thinking.

Are there strong arguments against maintaining such a cache?

#3 @scribu
13 years ago

  • Type changed from defect (bug) to enhancement

See #14983

Last edited 13 years ago by scribu (previous) (diff)

#4 @ericmann
11 years ago

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

Closing for now until we have some more progress on #14983.

#5 @dd32
11 years ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.