Closed (fixed)
Project:
Views (for Drupal 7)
Version:
7.x-3.x-dev
Component:
taxonomy data
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
7 Nov 2009 at 20:39 UTC
Updated:
25 May 2010 at 21:40 UTC
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%.
| Comment | File | Size | Author |
|---|---|---|---|
| views-validate-term-cache.patch | 1.89 KB | vgarvardt |
Comments
Comment #1
ajayg commentedDo you have the simple view exported? SO It will give an idea what type of views will benefit most.
Comment #2
vgarvardt commentedIt affects default taxonomy_term view, bundled with Views module, on term pages that include all child terms.
Comment #3
merlinofchaos commentedCommitted to 2.x and 3.x -- needs to be ported to 7.x-3.x as it does not apply.
Comment #4
vgarvardt commentedI'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?
Comment #5
merlinofchaos commentedYeah, 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
Comment #6
vgarvardt commentedWill subscribe to #626704: Build views integration for field.module so when it will be fixed I'll port my patch for D7 Views.
Comment #7
dawehnerEven if the taxonomy integration is different this table still exists.
Ported and commited the patch.