Breaking News: Grepper is joining You.com. Read the official announcement!
Check it out

is distinct or group by faster

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

Contents


More Related Answers

  • sql count distinct group by
  • big query get distinct array of objects
  • big query get distinct array of objects
  • lambda distinct by property
  • mongodb spring distinct query for multiple fields groupoperation
  • group unique property object

  • 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 5/10 Helpfulness 6/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.