Re: on cascade delete performances, transaction and set constraints deferred

From: Ivan Sergio Borgonovo <mail(at)webthatworks(dot)it>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: on cascade delete performances, transaction and set constraints deferred
Date: 2008-08-18 19:51:39
Message-ID: 20080818215139.484369c9@dawn.webthatworks.it
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, 18 Aug 2008 15:16:01 -0400
Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> Ivan Sergio Borgonovo <mail(at)webthatworks(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ivan Sergio Borgonovo 2008-08-18 20:01:19 explain inside begin; commit;
Previous Message Tom Lane 2008-08-18 19:16:01 Re: on cascade delete performances, transaction and set constraints deferred