假设我有一个像这样的SQL
select distinct CUSTOMER_PRODUCT_ORDER as ORDER
from MASTER_LIST
where PROJECT_ID = "ABCDD"
order by ORDER ASC
如何优化运行此sql的性能?
答案 0 :(得分:-1)
我认为在大多数情况下,使用group by会更好,更高效:
select CUSTOMER_PRODUCT_ORDER as ORDER
from MASTER_LIST
where PROJECT_ID = "ABCDD"
GROUP BY CUSTOMER_PRODUCT_ORDER
order by ORDER ASC