From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Jeff Janes <jeff(dot)janes(at)gmail(dot)com> |
Cc: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: AGG_PLAIN thinks sorts are free |
Date: | 2013-07-19 17:36:22 |
Message-ID: | 10280.1374255382@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Jeff Janes <jeff(dot)janes(at)gmail(dot)com> writes:
> On Thu, Jul 18, 2013 at 8:04 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2013-07-19 17:45:32 | Re: FKey not enforced resulting in broken Dump/Reload |
Previous Message | Alvaro Herrera | 2013-07-19 17:20:17 | Re: [HACKERS] getting rid of SnapshotNow |