News for hackers. Stuff that matters.
Re:Results of the SQL Performance Quiz by thwarted on Friday February 21, 2014 @02:47AM (#7275873)
No query optimizer would look at this and say "1M rows? Let's group and aggregate before filtering."

I hope no optimizer would say that. It is well defined that filtering, as expressed in the where clause (if it uses indexes or not) happens before group and aggregate, and that grouping happens on the result of the filtering. If the optimizer could choose one way or the other, you'd have different results. If you want to group and aggregate first, you need to explicitly express that with a subquery.

There are no comments on this comment yet.