Creating partitions automatically at least on HASH?

From: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
To: PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Creating partitions automatically at least on HASH?
Date: 2019-07-15 05:29:07
Message-ID: alpine.DEB.2.21.1907150711080.22273@lancre
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Hello pgdevs,

sorry if this has been already discussed, but G did not yield anything
convincing about that.

While looking at HASH partitioning and creating a few ones, it occured to
me that while RANGE and LIST partitions cannot be guessed easily, it would
be easy to derive HASH partitioned table for a fixed MODULUS, e.g. with

CREATE TABLE foo(...) PARTITION BY HASH AUTOMATIC (MODULUS 10);
-- or some other syntax

Postgres could derive statically the 10 subtables, eg named foo_$0$ to
foo_$1$.

That would not be a replacement for the feature where one may do something
funny and doubtful like (MODULUS 2 REMAINDER 0, MODULUS 4 REMAINDER 1,
MODULUS 4 REMAINDER 3).

The same declarative approach could eventually be considered for RANGE
with a fixed partition duration and starting and ending points.

This would be a relief on the longer path of dynamically creating
partitions, but with lower costs than a dynamic approach.

The ALTER thing would be a little pain.

Thoughts?

--
Fabien.

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2019-07-15 05:49:26 Re: A little report on informal commit tag usage
Previous Message Thomas Munro 2019-07-15 05:22:27 Re: XLogRecGetFullXid()