#16621 closed enhancement (maybelater)
Check term cache in _transform_terms()
Reported by: | 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)
#2
@
14 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?
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.