Adding exclusion constraint in a big table - Mailing list pgsql-performance

From Marcelo Fernandes
Subject Adding exclusion constraint in a big table
Date
Msg-id CAM2F1VNeP1itvrO0rDrwJJU5Us8X4EE-jPQ2yYA7NjygeXq3ZA@mail.gmail.com
Whole thread Raw
List pgsql-performance
Hi folks,

I need to add an exclusion constraint in a large table.

However, I'm worried about the length of time the table will be
blocked for reads and writes while the constraint is being
created.

With other operations, like adding unique indexes, I can create the
index first, concurrently, and then use that existing index to create
the constraint in place. This approach works well for large tables.

But this doesn't look like something I can do with exclusion
constraints, as I can't perform an ALTER TABLE ... USING INDEX ...

It also does not seem like I can add the constraint with a NOT VALID
condition either.

Do you folks have any recommendations for this situation?

pgsql-performance by date:

Previous
From: "Daniel Westermann (DWE)"
Date:
Subject: Bloom filters and the planner / parallel execution
Next
From: Ba Jinsheng
Date:
Subject: Unexpected Performance for the Function simplify_function