News for hackers. Stuff that matters.
Re:Use SQL subqueries to count distinct 50x faster by jeffdavis on Friday January 24, 2014 @11:24AM (#7115672)
I've never heard DISTINCT described as imperative.

It still leaves room to determine how and when to achieve the DISTINCT property, perhaps even doing no work at all.

* It can do a sort+unique or a hash, depending on cardinality, availability of memory, and a few other factors.

* It can push down a distinct or pull up a distinct, resulting in a faster plan.

* If there is another part of the plan that already implies distinct, like a GROUP BY, then it doesn't need to do any work at all. (Or similarly, if you're doing a distinct on a primary key).

There are no comments on this comment yet.