Re: deferring ForeignKey checks when you didn't set a deferrable constraint ?

From: Jonathan Vanasco <postgres(at)2xlp(dot)com>
To: PostgreSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Re: deferring ForeignKey checks when you didn't set a deferrable constraint ?
Date: 2014-11-21 15:46:08
Message-ID: B5B9D805-BC67-4F83-8C36-DF48684684BC@2xlp.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 the end 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.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Nestor A. Diaz 2014-11-21 17:22:20 Re: pgsql_tmp consuming all inodes
Previous Message Adrian Klaver 2014-11-21 15:21:28 Re: pgsql_tmp consuming all inodes