Re: deferring ForeignKey checks when you didn't set a deferrable constraint ? - Mailing list pgsql-general

From Jonathan Vanasco
Subject Re: deferring ForeignKey checks when you didn't set a deferrable constraint ?
Date
Msg-id B5B9D805-BC67-4F83-8C36-DF48684684BC@2xlp.com
Whole thread Raw
In response to Re: deferring ForeignKey checks when you didn't set a deferrable constraint ?  (Melvin Davidson <melvin6925@gmail.com>)
List pgsql-general
On Nov 20, 2014, at 6:00 PM, Melvin Davidson wrote:

> Try the following queries. It will give you two .sql files (create_fkeys.sql & drop_fkeys.sql).

Thanks!

I tried a variation of that to create DEFERRABLE constraints, and that was a mess.  It appears all the checks ran at
theend of the transaction individually – the process consumed 100% cpu overnight and was stuck on the 'commit' after 16
hours..

So I crossed my fingers and tried your code like this:

    BEGIN;
    DROP CONSTRAINT ..... x24;
    DELETE;
    ADD CONSTRAINT ..... x24;
    COMMIT;

And that took just over 24 seconds.



pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: pgsql_tmp consuming all inodes
Next
From: "Nestor A. Diaz"
Date:
Subject: Re: pgsql_tmp consuming all inodes