3 ms·
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
by jeffdavis 13y ago
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).