假设我有一个这样的SQL
select distinct CUSTOMER_PRODUCT_ORDER as ORDER
from MASTER_LIST
where PROJECT_ID = "ABCDD"
order by ORDER ASC
如何优化运行此 SQL 的性能?
我认为在大多数情况下,
分组会更好,性能更高:
select CUSTOMER_PRODUCT_ORDER as ORDER
from MASTER_LIST
where PROJECT_ID = "ABCDD"
GROUP BY CUSTOMER_PRODUCT_ORDER
order by ORDER ASC