Re: Change a constraint's index - ALTER TABLE ... ALTER CONSTRAINT ... USING INDEX ... - Mailing list pgsql-hackers

From Laurenz Albe
Subject Re: Change a constraint's index - ALTER TABLE ... ALTER CONSTRAINT ... USING INDEX ...
Date
Msg-id a4e73bb6f015bb465dec0d7604783a91ea22a44f.camel@cybertec.at
Whole thread Raw
In response to Re: Change a constraint's index - ALTER TABLE ... ALTER CONSTRAINT ... USING INDEX ...  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Responses Re: Change a constraint's index - ALTER TABLE ... ALTER CONSTRAINT ... USING INDEX ...  (Alvaro Herrera <alvherre@2ndquadrant.com>)
List pgsql-hackers
On Fri, 2020-09-04 at 10:41 -0400, Alvaro Herrera wrote:
> > The value I see in this is:
> > - replacing a primary key index
> > - replacing the index behind a constraint targeted by a foreign key
> 
> But why is this better than using REINDEX CONCURRENTLY?

It is not better, but it can be used to replace a constraint index
with an index with a different INCLUDE clause, which is something
that cannot easily be done otherwise.

For exclusion constraints it is pretty useless, and for unique
constraints it can be worked around with CREATE UNIQUE INDEX CONCURRENTLY.

Admitted, the use case is pretty narrow, and I am not sure if it is
worth adding code and SQL syntax for that.

Yours,
Laurenz Albe




pgsql-hackers by date:

Previous
From: Kelly Min
Date:
Subject: [PATCH] Comments related to " buffer descriptors“ cache line size"
Next
From: Laurenz Albe
Date:
Subject: Re: Add session statistics to pg_stat_database