Which is better: Distinct or Group By

后端 未结 6 988
南方客
南方客 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:29

    In most cases, DISTINCT and GROUP BY generate the same plans, and their performance is usually identical

提交回复
热议问题