Opened 13 years ago
Closed 9 years ago
#18778 closed enhancement (wontfix)
Add filters to transform_query() to allow caching of queries created by this function.
Reported by: | tott | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Taxonomy | Keywords: | 2nd-opinion reporter-feedback needs-patch needs-unit-tests |
Focuses: | Cc: |
Description
transform_query() works great on regular datasets, but if you run this on a large set of data it can get very expensive. adding some filters in here that could allow these queries to be cached would be benefitial.
Attachments (1)
Change History (13)
#3
@
13 years ago
The problem is that even with something like advanced-caching enabled these queries are fired in order to built the final query. So even if you would add caching on the final query it would still execute these queries on the way to build the final one. At least as far as I experienced this. Where would you hook into to avoid this queries?
#4
@
13 years ago
- Keywords 2nd-opinion added; close removed
I was thinking of the case where you can prevent the whole call to WP_Query by caching the list of posts. Not sure how practical that would be for the main query.
#6
follow-up:
↓ 7
@
13 years ago
The filter names here don't make sense to me.
If the idea (as it seems it is) is to suppress the code from running the queries that I would expect "suppress" to be in the name of the filter.
However, I'm not sure yet this is even the right place to be doing the suppression - maybe we should be doing it where we call the function instead?
#7
in reply to:
↑ 6
@
13 years ago
It is not really about suppressing the call. It's more about simply filling $terms with the necessary values without a db query. This would be the place where plugins like advanced-caching could jump in to avoid the query.
#10
@
10 years ago
A lot of this can be mitigated now because you can pass in term_taxonomy_id
s yourself, avoiding that particular transform. Trickier if you want to include children, though.
transform_query() is a private, intermediary step. I don't think it should be made public through a filter.
Why not cache the final result?