Re: AGG_PLAIN thinks sorts are free - Mailing list pgsql-hackers

From Tom Lane
Subject Re: AGG_PLAIN thinks sorts are free
Date
Msg-id 10280.1374255382@sss.pgh.pa.us
Whole thread Raw
In response to Re: AGG_PLAIN thinks sorts are free  (Jeff Janes <jeff.janes@gmail.com>)
List pgsql-hackers
Jeff Janes <jeff.janes@gmail.com> writes:
> On Thu, Jul 18, 2013 at 8:04 PM, Tom Lane <tgl@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
implystoring *all* the input values in    * the hash table, and/or running many sorts in parallel, either of which    *
seemslike a certain loser.)    */
 
        regards, tom lane



pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: getting rid of SnapshotNow
Next
From: Tom Lane
Date:
Subject: Re: FKey not enforced resulting in broken Dump/Reload