Details
-
Bug
-
Resolution: Fixed
-
Critical
-
None
Description
Queries using multiple attribute value criterions e.g.
$criteria = new LogicalAnd([ new Criterion\IntegerAttributeValue('integer', 10), new Criterion\IntegerAttributeValue('integer', 10), new Criterion\IntegerAttributeValue('integer', 10), new Criterion\IntegerAttributeValue('integer', 10), ]);
needs to be optimised in terms of execution time.
Example SQL query
SELECT DISTINCT c.*, main_tree.main_node_id AS main_tree_main_node_id, c.name AS `sort_column_0` FROM ezcontentobject c INNER JOIN ezcontentobject_version v ON c.id = v.contentobject_id LEFT JOIN ezcontentobject_tree main_tree ON (main_tree.contentobject_id = c.id) AND (main_tree.main_node_id = main_tree.node_id) LEFT JOIN ibexa_product_specification sort_table_0 ON c.id = sort_table_0.content_id AND c.current_version = sort_table_0.version_no WHERE ((((c.id IN (SELECT product_storage.content_id FROM ibexa_product_specification product_storage INNER JOIN ibexa_product_specification_attribute attribute_storage ON product_storage.id = attribute_storage.product_specification_id INNER JOIN ezcontentobject content_storage ON (product_storage.content_id = content_storage.id) AND (product_storage.version_no = content_storage.current_version) INNER JOIN ibexa_attribute_definition attribute_definition_storage ON attribute_storage.attribute_definition_id = attribute_definition_storage.id INNER JOIN ibexa_product_specification_attribute_integer attribute_value_storage ON attribute_value_storage.id = attribute_storage.id WHERE (attribute_definition_storage.identifier = 'integer') AND (attribute_value_storage.value = 10))) AND (c.id IN (SELECT product_storage.content_id FROM ibexa_product_specification product_storage INNER JOIN ibexa_product_specification_attribute attribute_storage ON product_storage.id = attribute_storage.product_specification_id INNER JOIN ezcontentobject content_storage ON (product_storage.content_id = content_storage.id) AND (product_storage.version_no = content_storage.current_version) INNER JOIN ibexa_attribute_definition attribute_definition_storage ON attribute_storage.attribute_definition_id = attribute_definition_storage.id INNER JOIN ibexa_product_specification_attribute_integer attribute_value_storage ON attribute_value_storage.id = attribute_storage.id WHERE (attribute_definition_storage.identifier = 'integer') AND (attribute_value_storage.value = 10))) AND (c.id IN (SELECT product_storage.content_id FROM ibexa_product_specification product_storage INNER JOIN ibexa_product_specification_attribute attribute_storage ON product_storage.id = attribute_storage.product_specification_id INNER JOIN ezcontentobject content_storage ON (product_storage.content_id = content_storage.id) AND (product_storage.version_no = content_storage.current_version) INNER JOIN ibexa_attribute_definition attribute_definition_storage ON attribute_storage.attribute_definition_id = attribute_definition_storage.id INNER JOIN ibexa_product_specification_attribute_integer attribute_value_storage ON attribute_value_storage.id = attribute_storage.id WHERE (attribute_definition_storage.identifier = 'integer') AND (attribute_value_storage.value = 10))) AND (c.id IN (SELECT product_storage.content_id FROM ibexa_product_specification product_storage INNER JOIN ibexa_product_specification_attribute attribute_storage ON product_storage.id = attribute_storage.product_specification_id INNER JOIN ezcontentobject content_storage ON (product_storage.content_id = content_storage.id) AND (product_storage.version_no = content_storage.current_version) INNER JOIN ibexa_attribute_definition attribute_definition_storage ON attribute_storage.attribute_definition_id = attribute_definition_storage.id INNER JOIN ibexa_product_specification_attribute_integer attribute_value_storage ON attribute_value_storage.id = attribute_storage.id WHERE (attribute_definition_storage.identifier = 'integer') AND (attribute_value_storage.value = 10)))) AND (c.id IN (SELECT product_storage.content_id FROM ibexa_product_specification product_storage))) AND (c.status = 1) AND (v.status = 1)) AND ((c.language_mask & 3) > 0) ORDER BY `sort_column_0` ASC LIMIT 25;
1 SIMPLE attribute_definition_storage const PRIMARY, attribute_definition_identifier_idx attribute_definition_identifier_idx 258 const 1 100 Using index; Using temporary; Using filesort 1 SIMPLE attribute_definition_storage const PRIMARY, attribute_definition_identifier_idx attribute_definition_identifier_idx 258 const 1 100 Using index 1 SIMPLE attribute_definition_storage const PRIMARY, attribute_definition_identifier_idx attribute_definition_identifier_idx 258 const 1 100 Using index 1 SIMPLE attribute_definition_storage const PRIMARY, attribute_definition_identifier_idx attribute_definition_identifier_idx 258 const 1 100 Using index 1 SIMPLE attribute_value_storage ref PRIMARY, ibexa_product_specification_attribute_integer_value_idx ibexa_product_specification_attribute_integer_value_idx 5 const 2 100 Using index; Start temporary 1 SIMPLE attribute_storage eq_ref PRIMARY, ibexa_product_specification_attribute_sid_idx, ibexa_product_specification_attribute_aid_idx PRIMARY 4 demo0306v2.attribute_value_storage.id 1 23.08 Using where 1 SIMPLE attribute_value_storage ref PRIMARY, ibexa_product_specification_attribute_integer_value_idx ibexa_product_specification_attribute_integer_value_idx 5 const 2 100 Using index 1 SIMPLE attribute_storage eq_ref PRIMARY, ibexa_product_specification_attribute_sid_idx, ibexa_product_specification_attribute_aid_idx PRIMARY 4 demo0306v2.attribute_value_storage.id 1 23.08 Using where 1 SIMPLE product_storage eq_ref PRIMARY, ibexa_product_specification_cv PRIMARY 4 demo0306v2.attribute_storage.product_specification_id 1 100 1 SIMPLE product_storage eq_ref PRIMARY, ibexa_product_specification_cv PRIMARY 4 demo0306v2.attribute_storage.product_specification_id 1 50 Using where 1 SIMPLE v ref ezcobj_version_status, idx_object_version_objver, ezcontobj_version_obj_status ezcontobj_version_obj_status 9 demo0306v2.product_storage.content_id, const 1 100 Using index 1 SIMPLE c eq_ref PRIMARY, ezcontentobject_status PRIMARY 4 demo0306v2.product_storage.content_id 1 100 Using where 1 SIMPLE content_storage eq_ref PRIMARY, ezcontentobject_currentversion PRIMARY 4 demo0306v2.product_storage.content_id 1 25 Using where 1 SIMPLE product_storage ref PRIMARY, ibexa_product_specification_cv ibexa_product_specification_cv 4 demo0306v2.product_storage.content_id 1 100 Using index 1 SIMPLE content_storage eq_ref PRIMARY, ezcontentobject_currentversion PRIMARY 4 demo0306v2.product_storage.content_id 1 25 Using where 1 SIMPLE content_storage eq_ref PRIMARY, ezcontentobject_currentversion PRIMARY 4 demo0306v2.product_storage.content_id 1 25 Using where 1 SIMPLE attribute_value_storage ref PRIMARY, ibexa_product_specification_attribute_integer_value_idx ibexa_product_specification_attribute_integer_value_idx 5 const 2 100 Using index 1 SIMPLE attribute_storage eq_ref PRIMARY, ibexa_product_specification_attribute_sid_idx, ibexa_product_specification_attribute_aid_idx PRIMARY 4 demo0306v2.attribute_value_storage.id 1 23.08 Using where 1 SIMPLE attribute_value_storage ref PRIMARY, ibexa_product_specification_attribute_integer_value_idx ibexa_product_specification_attribute_integer_value_idx 5 const 2 100 Using index 1 SIMPLE attribute_storage eq_ref PRIMARY, ibexa_product_specification_attribute_sid_idx, ibexa_product_specification_attribute_aid_idx PRIMARY 4 demo0306v2.attribute_value_storage.id 1 7.69 Using where 1 SIMPLE main_tree ref ezcontentobject_tree_co_id ezcontentobject_tree_co_id 5 demo0306v2.product_storage.content_id 1 100 Using where 1 SIMPLE product_storage eq_ref PRIMARY, ibexa_product_specification_cv PRIMARY 4 demo0306v2.attribute_storage.product_specification_id 1 50 Using where; Distinct 1 SIMPLE content_storage eq_ref PRIMARY, ezcontentobject_currentversion PRIMARY 4 demo0306v2.product_storage.content_id 1 25 Using where; Distinct 1 SIMPLE product_storage ref ibexa_product_specification_cv ibexa_product_specification_cv 4 demo0306v2.product_storage.content_id 1 100 Using index; Distinct 1 SIMPLE sort_table_0 ref ibexa_product_specification_cv ibexa_product_specification_cv 8 demo0306v2.product_storage.content_id, demo0306v2.c.current_version 1 100 Using index; Distinct; End temporary
Designs
Attachments
Issue Links
- is duplicated by
-
IBX-3202 As a Developer I want to be able to query multiple attributes in Product Catalog on Legacy search engine without significant slowdown
- Closed