Closed (fixed)
Project:
Relation
Version:
7.x-1.x-dev
Component:
API
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
20 Feb 2012 at 06:21 UTC
Updated:
11 Mar 2012 at 21:20 UTC
Jump to comment: Most recent file
relation_get_related_entity() causes a temporary table:
SELECT DISTINCT field_data_endpoints0.entity_type AS entity_type, field_data_endpoints0.entity_id AS entity_id, field_data_endpoints0.revision_id AS revision_id, field_data_endpoints0.bundle AS bundle FROM field_data_endpoints field_data_endpoints0 INNER JOIN field_data_endpoints field_data_endpoints1 ON field_data_endpoints1.entity_type = field_data_endpoints0.entity_type AND field_data_endpoints1.entity_id = field_data_endpoints0.entity_id WHERE (field_data_endpoints0.endpoints_entity_type = :db_condition_placeholder_0) AND (field_data_endpoints1.endpoints_entity_id = :db_condition_placeholder_1) AND (field_data_endpoints1.delta = field_data_endpoints0.delta) AND (field_data_endpoints0.deleted = :db_condition_placeholder_2) AND (field_data_endpoints0.entity_type = :db_condition_placeholder_3) AND (field_data_endpoints0.bundle = :db_condition_placeholder_4) LIMIT 50 OFFSET 0
id select_type table type possible_keys key key_len ref rows extra
1 SIMPLE field_data_endpoints0 ref PRIMARY,entity_type,bundle,deleted,entity_id,endpoints_relation bundle 386 const 3820 Using where; Using temporary
1 SIMPLE field_data_endpoints1 ref PRIMARY,entity_type,entity_id PRIMARY 390 const,itv.field_data_endpoints0.entity_id 1 Using where; Distinct
Attached patch doesn't try to fix the query since that would involve removing the DISTINCT that EntityFieldQuery adds, this might be worth looking at but it's unlikely to be fixable in relation. Instead I'm persistently caching relations, then clearing in relation_save() for all endpoints.
, but just adds caching of relations for now
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | relation.patch | 1.21 KB | catch |
| #4 | relation.patch | 1.2 KB | catch |
| #3 | relation_1446512.patch | 3.28 KB | catch |
| #2 | relation_1446512.patch | 1.58 KB | catch |
| #1 | relation_1446512.patch | 1.64 KB | catch |
Comments
Comment #1
catchComment #2
catchDidn't mean to take out the static cache clear.
Comment #3
catchHere's one with tests, I verified that the test fails if the cache clear is removed, current test coverage would not have caught this.
Comment #4
catchFound a bug.
Comment #5
catchComment #6
chx commented