Re: should CREATE INDEX ON partitioned_table call PreventInTransactionBlock() ?

From: Justin Pryzby <pryzby(at)telsasoft(dot)com>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: should CREATE INDEX ON partitioned_table call PreventInTransactionBlock() ?
Date: 2020-06-08 15:40:45
Message-ID: 20200608154045.GV22473@telsasoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Jun 08, 2020 at 11:27:26AM -0400, Alvaro Herrera wrote:
> On 2020-Jun-08, Justin Pryzby wrote:
>
> > This blocks writes to all partitions until commit:
> >
> > postgres=# begin; CREATE INDEX ON pt(i);
> > BEGIN
> > CREATE INDEX
> >
> > Compare with CLUSTER rel1, rel2, ..., and REINDEX {SCHEMA|DATABASE|SYSTEM},
> > which release their locks as soon as each rel is processed.

(Correcting myself, I guess I mean "CLUSTER;" - it doesn't accept multiple
relation arguments.)

> Well, that would also require that transactions are committed and
> started for each partition. Merely adding PreventInTransactionBlock
> would not do that. Moreover, since this would break DDL-in-transactions
> that would otherwise work, it should be optional and thus need a keyword
> in the command. But CONCURRENTLY isn't it (because that means something
> else) so we'd have to discuss what it would be.

I wasn't thinking of a new feature but rather if it would be desirable to
change behavior for v14 to always start/commit transaction for each partition.

--
Justin

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Anastasia Lubennikova 2020-06-08 15:44:23 Re: pg_upgrade fails with non-standard ACL
Previous Message Alvaro Herrera 2020-06-08 15:27:26 Re: should CREATE INDEX ON partitioned_table call PreventInTransactionBlock() ?