Huge performance difference when using GROUP BY vs DISTINCT
The two queries express the same question. Apparently the query optimizer chooses two different execution plans. My guess would be that the distinct approach is executed like: Copy all business_key values to a temporary table Sort the temporary table Scan the temporary table, returning each item that is different from the one before it The … Read more