我想询问是否有关于遵循表现的良好做法。
我的SQL SELECT:
SELECT avpc.category_id, a.attribute_id, ad.name, a.type, a.sort_order, avpc.attribute_value_id, avd.value, COUNT(pav.product_id) AS product_count
FROM attribute_value_per_category avpc
JOIN category_path cp ON cp.category_id = avpc.category_id
JOIN attribute_value av ON av.attribute_value_id = avpc.attribute_value_id
JOIN attribute_value_description avd ON avd.attribute_value_id = av.attribute_value_id AND avd.language_id = 2
JOIN attribute a ON a.attribute_id = av.attribute_id
JOIN attribute_description ad ON ad.attribute_id = a.attribute_id AND ad.language_id = 2
JOIN product_attribute_value pav ON pav.attribute_value_id = av.attribute_value_id
WHERE path_id = 2
GROUP BY attribute_value_id
我需要添加条件:HAVING product_count > 10
。我读过,HAVING很慢,而且没有优化。
所以我有这两个建议:
请您就此问题的表现给我任何建议吗?