[英]How to optimize and speed up current Magento SQL query?
How to optimize current Magento SQL query? 如何优化当前的Magento SQL查询?
SELECT customer_entity.email, COUNT(sales_flat_order.increment_id)
AS number_of_orders
FROM customer_entity
LEFT JOIN sales_flat_order ON sales_flat_order.customer_email =
customer_entity.email
GROUP BY customer_entity.email
ORDER BY number_of_orders DESC;
why even doing a Join if customer_email is present in the same table? 如果同一表中存在customer_email,为什么还要进行Join?
SELECT `customer_email`, COUNT(increment_id) as number_of_orders
FROM `sales_flat_order`
GROUP BY customer_email
ORDER BY number_of_orders DESC;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.