Re: on cascade delete performances, transaction and set constraints deferred - Mailing list pgsql-general

From Ivan Sergio Borgonovo
Subject Re: on cascade delete performances, transaction and set constraints deferred
Date
Msg-id 20080818215139.484369c9@dawn.webthatworks.it
Whole thread Raw
In response to Re: on cascade delete performances, transaction and set constraints deferred  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
On Mon, 18 Aug 2008 15:16:01 -0400
Tom Lane <tgl@sss.pgh.pa.us> wrote:

> Ivan Sergio Borgonovo <mail@webthatworks.it> writes:
> > I'm not sure what's really happening but why apparently the
> > delete statements get executed before the 2 inserts even if
> > constraints are deferred?
>
> You didn't mark the FK constraints as deferrable --- I'm pretty
> sure the default is NOT DEFERRABLE.

My fault. I don't know how did I succeeded to read that the default
was DEFERRABLE while it is clearly stated it is not.

I can't see a direct way to add DEFERRABLE to an already existing
constraint. Is dropping and adding the only path?

> > Why does it take so long?
>
> Indexes on the FK columns would probably help.

There is one actually. I'll post another email with a more sensible
subject to ask more advices on this, if google doesn't help me first.

Thanks.

--
Ivan Sergio Borgonovo
http://www.webthatworks.it


pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: on cascade delete performances, transaction and set constraints deferred
Next
From: Ivan Sergio Borgonovo
Date:
Subject: explain inside begin; commit;