Taxonomy term validation perfornamce improvement
vgarvardt - November 7, 2009 - 20:39
| Project: | Views |
| Version: | 7.x-3.x-dev |
| Component: | taxonomy data |
| Category: | task |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | patch (to be ported) |
Jump to:
Description
While working on one of my Drupal projects performance optimization and queries profiling I found several groups of queries that looks like:
SELECT * FROM term_data WHERE tid IN (tid1, tid2, tid3)
SELECT * FROM term_data WHERE tid IN (tid1)
SELECT * FROM term_data WHERE tid IN (tid2)
SELECT * FROM term_data WHERE tid IN (tid3)As you can see there were N+1 queries that verified N terms, and single SELECT queries always followed by SELECT query that includes all single.
After I applied my patch, that implements caching for validation results, single queries disappeared and I got 315 queries instead of 609 for view I tested on and page generation time decreased for almost 50%.
| Attachment | Size |
|---|---|
| views-validate-term-cache.patch | 1.89 KB |

#1
Do you have the simple view exported? SO It will give an idea what type of views will benefit most.
#2
It affects default taxonomy_term view, bundled with Views module, on term pages that include all child terms.
#3
Committed to 2.x and 3.x -- needs to be ported to 7.x-3.x as it does not apply.
#4
I'm not this is possible with current D7 Views state.
I installed Taxonomy in D7, added field, generated taxonomy terms, nodes, tested with taxonomy/term/1 and got list with 1 node. Then I installed views 7.x-3.x-dev from October 20, 2009 (latest version I found in releases), enabled taxonomy_term view, tried taxonomy/term/1 and got "Page not found", Views debug message
and PHP notice
Should I use CVS version of Views for D7? If yes - please give me the url.
Or it would be better to create separate issue for this?
#5
Yeah, taxonomy in D7 has changed a lot -- I think it may not be possible until the field integration is complete. See http://drupal.org/node/626704
#6
Will subscribe to #626704: Build views integration for field.module so when it will be fixed I'll port my patch for D7 Views.