On Wed, May 15, 2024 at 2:09 AM Ron Johnson <ronljohnso...@gmail.com> wrote:

> On Tue, May 14, 2024 at 3:59 PM sud <suds1...@gmail.com> wrote:
>
>> *****
>>
> ALTER TABLE ADD FOREIGN KEY ... NOT VALID.
>> ALTER TABLE ... VALIDATE CONSTRAINT;
>>
>>
> This is what we did, back in the PG 12.x period.  VALIDATE CONSTRAINT was
> almost instantaneous.  (Supporting indices existed, though.)
>
>
Thank you. Actually we do have a composite index on the child table columns
which is referring to the parent table. And in the parent table those
columns are the primary keys. So even then it's taking ~20minutes for each
partition.

So is there some other way to make it run faster
or
 Can we run it concurrently
or
Should we keep the existing constraints in "not valid" state only?

Reply via email to