Re: Adding a ROLLUP switches to GroupAggregate unexpectedly
От | ktm@rice.edu |
---|---|
Тема | Re: Adding a ROLLUP switches to GroupAggregate unexpectedly |
Дата | |
Msg-id | 20160331190803.GH29284@aart.rice.edu обсуждение исходный текст |
Ответ на | Re: Adding a ROLLUP switches to GroupAggregate unexpectedly (Tom Lane <tgl@sss.pgh.pa.us>) |
Список | pgsql-performance |
On Thu, Mar 31, 2016 at 02:56:48PM -0400, Tom Lane wrote: > Chris Cogdon <chris@cogdon.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
В списке pgsql-performance по дате отправления: