Re: [PATCH] Automatic HASH and LIST partition creation - Mailing list pgsql-hackers

From Robert Haas
Subject Re: [PATCH] Automatic HASH and LIST partition creation
Date
Msg-id CA+TgmoatUTK+MODYF3F1Fb_LH77b2dn0d8F1C3tfyTF66tWbhw@mail.gmail.com
Whole thread Raw
In response to Re: [PATCH] Automatic HASH and LIST partition creation  (Justin Pryzby <pryzby@telsasoft.com>)
Responses Re: [PATCH] Automatic HASH and LIST partition creation  (Daniel Gustafsson <daniel@yesql.se>)
List pgsql-hackers
On Tue, Jul 20, 2021 at 3:13 PM Justin Pryzby <pryzby@telsasoft.com> wrote:
> On Tue, Jul 20, 2021 at 02:42:16PM -0400, Robert Haas wrote:
> > The bigger issue IMHO with on-the-fly
> > partition creation is avoiding deadlocks in the presence of current
> > inserters; I submit that without at least some kind of attempt to
> > avoid deadlocks and spurious errors there, it's not really a usable
> > scheme, and that seems hard.
>
> I was thinking that for dynamic creation, there would be a DDL command to
> create the necessary partitions:
>
> -- Creates 2021-01-02, unless the month already exists:
> ALTER TABLE bydate SET GRANULARITY='1day';
> ALTER TABLE bydate CREATE PARTITION FOR VALUE ('2021-01-02');

Well, that dodges the deadlock issue with doing it implicitly, but it
also doesn't seem to offer a lot of value over just creating the
partitions in a fully manual way. I mean you could just say:

CREATE TABLE bydate_2021_02_02 PARTITION OF bydate FOR VALUES FROM
('2021-01-02') TO ('2021-02-03');

It's longer, but it's not really that bad.

-- 
Robert Haas
EDB: http://www.enterprisedb.com



pgsql-hackers by date:

Previous
From: Justin Pryzby
Date:
Subject: Re: [PATCH] Automatic HASH and LIST partition creation
Next
From: Mark Dilger
Date:
Subject: Re: refactoring basebackup.c