Use group by instead of distinct

0 Kudos

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.