| From: | "ktm(at)rice(dot)edu" <ktm(at)rice(dot)edu> |
|---|---|
| To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
| Cc: | Chris Cogdon <chris(at)cogdon(dot)org>, pgsql-performance(at)postgresql(dot)org |
| Subject: | Re: Adding a ROLLUP switches to GroupAggregate unexpectedly |
| Date: | 2016-03-31 19:08:03 |
| Message-ID: | 20160331190803.GH29284@aart.rice.edu |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-performance |
On Thu, Mar 31, 2016 at 02:56:48PM -0400, Tom Lane wrote:
> Chris Cogdon <chris(at)cogdon(dot)org> writes:
> > Hi folks! I’ve a query where adding a rollup to the group by switches to
> > GroupAggregate unexpectedly, where the standard GROUP BY uses
> > HashAggregate.
>
> The current implementation of rollup doesn't support using hashed
> aggregation. I don't know if that's for lack of round tuits or because
> it's actually hard, but it's not the planner's fault.
>
> regards, tom lane
>
Hi,
Cribbed from the mailing list:
http://www.postgresql.org/message-id/E1YtRD5-0005Q7-SM@gemulon.postgresql.org
The current implementation of grouping sets only supports using sorting
for input. Individual sets that share a sort order are computed in one
pass. If there are sets that don't share a sort order, additional sort &
aggregation steps are performed. These additional passes are sourced by
the previous sort step; thus avoiding repeated scans of the source data.
The code is structured in a way that adding support for purely using
hash aggregation or a mix of hashing and sorting is possible. Sorting
was chosen to be supported first, as it is the most generic method of
implementation.
Regards,
Ken
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Jarek | 2016-03-31 19:08:06 | Big number of connections |
| Previous Message | Tom Lane | 2016-03-31 18:56:48 | Re: Adding a ROLLUP switches to GroupAggregate unexpectedly |