Re: Build exclusion constraints USING INDEX

From: Steven Winfield <Steven(dot)Winfield(at)cantabcapital(dot)com>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Build exclusion constraints USING INDEX
Date: 2017-02-10 12:05:25
Message-ID: E9FA92C2921F31408041863B74EE4C20016CD5BF0D@CCPMAILDAG03.cantab.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> I was wondering if there was any way to break down the creation of a new exclusion constraint into stages such that table locks most likely to affect performance during production hours are not taken.
>
> Something like:
>
> CREATE INDEX CONCURRENTLY new_index ON my_table USING gist (column1, column2, column3);
> ALTER TABLE my_table ADD CONSTRAINT my_exclusion_constraint EXCLUDE USING INDEX new_index (column1 WITH &&, column2 WITH =, column3 WITH &&) NOT VALID;
> ALTER TABLE my_table VALIDATE CONSTRAINT my_exclusion_constraint;
>
> AFAICT nothing like the second statement is currently available, but I wanted to check that and see if there are any workarounds.

I'm guessing there aren't any workarounds then, and exclusion constraints will lock the whole table against writes while they are being created?

Steve.

Browse pgsql-general by date

  From Date Subject
Next Message Peter J. Holzer 2017-02-10 13:02:06 Loose indexscan and partial indexes
Previous Message Gunnar "Nick" Bluth 2017-02-10 10:23:20 Re: postgresql : could not serialize access due to read/write dependencies among transactions