Closed (fixed)
Project:
Metatag
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
20 Nov 2013 at 17:39 UTC
Updated:
27 Aug 2014 at 02:00 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
juampynr commentedThe metatag table already has indexes. So there is little extra which can be done to improve a query with a long list of nodes to be loaded, such as the one mentioned at #2139925: Very slow query (using IN operator).
Comment #2
juampynr commentedCorrection, there is just one primary index for the composite key. Me and @q0rban played with indexes to see if we could optimize the query at metatag_metatags_load_multiple(), until we realized that beta9 already did it by removing revision_ids from the WHERE clause.
I do not know which API functions would benefit from extra indexes at the moment.
Comment #3
ttkaminski commentedI found that adding an index for (entity_type,revision_id) sped up some of the metatag queries significantly. In particular, this query was slow:
From the EXPLAIN statement, it showed that in my case, 7500 rows were being scanned. After adding the index, only 4 rows were scanned.
Comment #4
damienmckenna@ttkaminski: If you'd mind rolling a patch for this I'd be happy to include it in 1.0 this week!
Comment #5
ttkaminski commentedAttached is a patch.
Comment #6
damienmckennaComment #7
damienmckennaA slight update to add a drupal_set_message call, and fix two errant spaces.
Comment #8
damienmckennaCommitted. Thanks @ttkaminski!