Jeff Janes <jeff.ja...@gmail.com> writes: > On Thu, Jul 18, 2013 at 8:04 PM, Tom Lane <t...@sss.pgh.pa.us> wrote: >> DISTINCT (and also ORDER BY) properties of aggregates are implemented >> at runtime; the planner doesn't really do anything about them, except >> suppress the choice it might otherwise make of using hashed aggregation.
> Couldn't a hash aggregate be superior to a sort one (for the distinct, > not the order by)? If it worked at all, it might be superior, but since it doesn't, it ain't. This isn't really a matter of lack of round tuits, but a deliberate judgment that it's probably not worth the trouble. Per the comment in choose_hashed_grouping: /* * Executor doesn't support hashed aggregation with DISTINCT or ORDER BY * aggregates. (Doing so would imply storing *all* the input values in * the hash table, and/or running many sorts in parallel, either of which * seems like a certain loser.) */ regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers