Re: temporarily disabling foreign keys

From: Seb <spluque(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: temporarily disabling foreign keys
Date: 2011-05-11 14:38:04
Message-ID: 87oc39b8vn.fsf@kolob.subpolar.dyndns.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, 10 May 2011 14:29:48 -0400,
Vick Khera <vivek(at)khera(dot)org> wrote:

> in recent versions of postgres, there is a "replication" mode designed
> specifically for replication software to disable FK's and other
> triggers. Perhaps investigate that.

> the other option is to make your FK's deferrable, and do all your
> delete in one big transaction with the FK checks deferred. not sure
> if that will help.

> either that, or order your deletes and loads in a way such that the
> FKs remain satisfied. unless you have circular dependencies, this
> should be possible.

Excellent, this last suggestion was actually a very simple and efficient
solution. However, I got curious about the deferrable FK's, which might
make this and other scripts more flexible.

Thanks everyone for your feedback,

--
Seb

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Stanislav Raskin 2011-05-11 14:39:50 Re: full text search to_tsquery performance with ispell dictionary
Previous Message galy lee 2011-05-11 14:37:39 PostgreSQL conference China 2011 Announced!