is distinct or group by faster

notPlancha answered on April 6, 2023 Popularity 6/10 Helpfulness 5/10

Contents


More Related Answers


is distinct or group by faster

1

They are essentially equivalent to each other (in fact this is how some databases implement DISTINCT under the hood).

If one of them is faster, it's going to be DISTINCT. This is because, although the two are the same, a query optimizer would have to catch the fact that your GROUP BY is not taking advantage of any group members, just their keys. DISTINCT makes this explicit, so you can get away with a slightly dumber optimizer. 

Popularity 6/10 Helpfulness 5/10 Language whatever
Link to this answer
Share Copy Link
Contributed on Apr 06 2023
notPlancha
0 Answers  Avg Quality 2/10


X

Continue with Google

By continuing, I agree that I have read and agree to Greppers's Terms of Service and Privacy Policy.
X
Grepper Account Login Required

Oops, You will need to install Grepper and log-in to perform this action.