Creating partitions automatically at least on HASH? - Mailing list pgsql-hackers

From Fabien COELHO
Subject Creating partitions automatically at least on HASH?
Date
Msg-id alpine.DEB.2.21.1907150711080.22273@lancre
Whole thread Raw
Responses Re: Creating partitions automatically at least on HASH?
List 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.



pgsql-hackers by date:

Previous
From: Thomas Munro
Date:
Subject: Re: XLogRecGetFullXid()
Next
From: Thomas Munro
Date:
Subject: Re: A little report on informal commit tag usage