Thread: [COMMITTERS] pgsql: Add hash partitioning.

[COMMITTERS] pgsql: Add hash partitioning.

From
Robert Haas
Date:
Add hash partitioning.

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

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/1aba8e651ac3e37e1d2d875842de1e0ed22a651e

Modified Files
--------------
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(-)


--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers

Re: [COMMITTERS] pgsql: Add hash partitioning.

From
Andreas Seltenreich
Date:
Robert Haas writes:

> Add hash partitioning.

sqlsmith triggers coredumps calling satisfies_hash_partition().
ISTM this function is lacking argument validation.  Example:

,----
| PostgreSQL stand-alone backend 11devel
| backend> select satisfies_hash_partition('pg_class'::regclass,null,null,null);
| Program received signal SIGSEGV, Segmentation fault.
| 0x00005555556b3914 in satisfies_hash_partition (fcinfo=0x555555f5f668) at partition.c:3435
| 3435                fmgr_info_copy(&my_extra->partsupfunc[j],
`----

regards,
Andreas


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers

Re: [COMMITTERS] pgsql: Add hash partitioning.

From
amul sul
Date:
On Sun, Nov 12, 2017 at 3:01 AM, Andreas Seltenreich <seltenreich@gmx.de> wrote:
> Robert Haas writes:
>
>> Add hash partitioning.
>
> sqlsmith triggers coredumps calling satisfies_hash_partition().
> ISTM this function is lacking argument validation.  Example:
>

Thanks for the bug report.  Please find attached patch does the fix.

Regards,
Amul

-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers

Attachment

Re: [COMMITTERS] pgsql: Add hash partitioning.

From
amul sul
Date:
On Mon, Nov 13, 2017 at 12:41 PM, amul sul <sulamul@gmail.com> wrote:
> On Sun, Nov 12, 2017 at 3:01 AM, Andreas Seltenreich <seltenreich@gmx.de> wrote:
>> Robert Haas writes:
>>
>>> Add hash partitioning.
>>
>> sqlsmith triggers coredumps calling satisfies_hash_partition().
>> ISTM this function is lacking argument validation.  Example:
>>
>
> Thanks for the bug report.  Please find attached patch does the fix.

Updated patch attached -- Adjusted code comment to survive against pgindent.

Regards,
Amul

-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers

Attachment