Search Postgresql Archives

Re: Adding constraints faster

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Wed, May 15, 2024 at 2:09 AM Ron Johnson <ronljohnsonjr@xxxxxxxxx> wrote:
On Tue, May 14, 2024 at 3:59 PM sud <suds1434@xxxxxxxxx> 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?


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux