1. 程式人生 > >distinct和group by的效率

distinct和group by的效率

加了索引之後 distinct 比沒加索引的 distinct 快。
加了索引之後 group by 比沒加索引的 group by 快。
再來對比 :distinct  和 group by
不管是加不加索引 group by 都比 distinct 快。因此使用的時候建議選 group by