public inbox for [email protected]  
help / color / mirror / Atom feed
From: sud <[email protected]>
To: Ron Johnson <[email protected]>
Cc: pgsql-general <[email protected]>
Subject: Re: Adding constraints faster
Date: Wed, 15 May 2024 08:32:50 +0530
Message-ID: <CAD=mzVUjcXY2Ss02aOiNWFCs46902pPM8HbXBrPg0sa=M=osbA@mail.gmail.com> (raw)
In-Reply-To: <CANzqJaCkpoOY2cr=XTCGkPYoc3SffjoGWYTkT=Tn6uaLb1xsPg@mail.gmail.com>
References: <CAD=mzVUrWysYQGy336aDM8=wqFBctv3ikW=_g9JWZDPpbrsKNQ@mail.gmail.com>
	<CANzqJaCkpoOY2cr=XTCGkPYoc3SffjoGWYTkT=Tn6uaLb1xsPg@mail.gmail.com>

On Wed, May 15, 2024 at 2:09 AM Ron Johnson <[email protected]> wrote:

> On Tue, May 14, 2024 at 3:59 PM sud <[email protected]> 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?


view thread (2+ messages)

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: Adding constraints faster
  In-Reply-To: <CAD=mzVUjcXY2Ss02aOiNWFCs46902pPM8HbXBrPg0sa=M=osbA@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox