On Tue, Jul 20, 2021 at 3:13 PM Justin Pryzby <pry...@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