Add hash partitioning

Enterprise / PostgreSQL - Robert Haas [postgresql.org] - 9 November 2017 23:07 EST

Hash partitioning is useful when you want to partition a growing data set evenly. This can be useful to keep table sizes reasonable, which makes maintenance operations such as VACUUM faster, or to enable partition-wise join.

At present, we still depend on constraint exclusion for partitioning pruning, and the shape of the partition constraints for hash partitioning is such that that doesn't work. Work is underway to fix that, which should both improve performance and make partitioning pruning work with hash partitioning.

Amul Sul, reviewed and tested by Dilip Kumar, Ashutosh Bapat, Yugo Nagata, Rajkumar Raghuwanshi, Jesper Pedersen, and by me. A few final tweaks also by me.

Discussion: http://postgr.es/m/CAAJ_b96fhpJAP=ALbETmeLk1Uni_GFZD938zgenhF49qgDTjaQ@mail.gmail.com

1aba8e651a Add hash partitioning.
doc/src/sgml/ddl.sgml | 28 +-
doc/src/sgml/ref/alter_table.sgml | 7 +
doc/src/sgml/ref/create_table.sgml | 85 +++-
src/backend/catalog/partition.c | 682 ++++++++++++++++++++++++---
src/backend/commands/tablecmds.c | 48 +-
src/backend/nodes/copyfuncs.c | 2 +
src/backend/nodes/equalfuncs.c | 2 +
src/backend/nodes/outfuncs.c | 2 +
src/backend/nodes/readfuncs.c | 2 +
src/backend/optimizer/path/joinrels.c | 12 +-
src/backend/parser/gram.y | 76 ++-
src/backend/parser/parse_utilcmd.c | 29 +-
src/backend/utils/adt/ruleutils.c | 15 +-
src/backend/utils/cache/relcache.c | 26 +-
src/bin/psql/tab-complete.c | 2 +-
src/include/catalog/catversion.h | 2 +-
src/include/catalog/partition.h | 3 +
src/include/catalog/pg_proc.h | 4 +
src/include/nodes/parsenodes.h | 8 +-
src/test/regress/expected/alter_table.out | 62 +++
src/test/regress/expected/create_table.out | 78 ++-
src/test/regress/expected/insert.out | 46 ++
src/test/regress/expected/partition_join.out | 81 ++++
src/test/regress/expected/update.out | 29 ++
src/test/regress/sql/alter_table.sql | 64 +++
src/test/regress/sql/create_table.sql | 51 +-
src/test/regress/sql/insert.sql | 33 ++
src/test/regress/sql/partition_join.sql | 32 ++
src/test/regress/sql/update.sql | 28 ++
src/tools/pgindent/typedefs.list | 1 +
30 files changed, 1420 insertions(+), 120 deletions(-)

Upstream: git.postgresql.org


  • Share