Use group by instead of distinct

natejgardner
natejgardner Neuron, Registered, Neuron 2022, Neuron 2023 Posts: 151 Neuron

Several recipes conveniently provide the ability to select distinct on their outputs, but this is highly inefficient in most databases. The same result can usually be achieved much faster by grouping by all the columns. Ideally, when the distinct option is selected in recipes, the resulting sql will prefer group by to distinct, at least in databases where group by is strictly better.

0
0 votes

New · Last Updated

Setup Info
    Tags
      Help me…