]> granicus.if.org Git - postgresql/commit
Implement partition-wise grouping/aggregation.
authorRobert Haas <rhaas@postgresql.org>
Thu, 22 Mar 2018 16:49:48 +0000 (12:49 -0400)
committerRobert Haas <rhaas@postgresql.org>
Thu, 22 Mar 2018 16:49:48 +0000 (12:49 -0400)
commite2f1eb0ee30d144628ab523432320f174a2c8966
treec966ef6a6de9c5e3e4a8c6a0b310cb61306535f5
parent2058d6a22b43a97d1069a51bd95ad56759b3c7bc
Implement partition-wise grouping/aggregation.

If the partition keys of input relation are part of the GROUP BY
clause, all the rows belonging to a given group come from a single
partition.  This allows aggregation/grouping over a partitioned
relation to be broken down * into aggregation/grouping on each
partition.  This should be no worse, and often better, than the normal
approach.

If the GROUP BY clause does not contain all the partition keys, we can
still perform partial aggregation for each partition and then finalize
aggregation after appending the partial results.  This is less certain
to be a win, but it's still useful.

Jeevan Chalke, Ashutosh Bapat, Robert Haas.  The larger patch series
of which this patch is a part was also reviewed and tested by Antonin
Houska, Rajkumar Raghuwanshi, David Rowley, Dilip Kumar, Konstantin
Knizhnik, Pascal Legrand, and Rafia Sabih.

Discussion: http://postgr.es/m/CAM2+6=V64_xhstVHie0Rz=KPEQnLJMZt_e314P0jaT_oJ9MR8A@mail.gmail.com
17 files changed:
doc/src/sgml/config.sgml
src/backend/optimizer/README
src/backend/optimizer/path/allpaths.c
src/backend/optimizer/path/costsize.c
src/backend/optimizer/plan/createplan.c
src/backend/optimizer/plan/planner.c
src/backend/utils/misc/guc.c
src/backend/utils/misc/postgresql.conf.sample
src/include/nodes/relation.h
src/include/optimizer/cost.h
src/include/optimizer/paths.h
src/test/regress/expected/partition_aggregate.out [new file with mode: 0644]
src/test/regress/expected/sysviews.out
src/test/regress/parallel_schedule
src/test/regress/serial_schedule
src/test/regress/sql/partition_aggregate.sql [new file with mode: 0644]
src/tools/pgindent/typedefs.list