Which is better: Distinct or Group By

后端 未结 6 1064
南方客
南方客 2021-02-07 12:45

Which is more efficient?

SELECT  theField
FROM    theTable
GROUP BY theField

or

SELECT  DISTINCT theField
FROM    theTable
         


        
6条回答
  •  没有蜡笔的小新
    2021-02-07 13:26

    You can check the Execution Plan to look for the total cost of this statements. The answer may vary in different scenarios.

提交回复
热议问题