Re: Poor performance for delete query - Mailing list pgsql-performance

From Tom Lane
Subject Re: Poor performance for delete query
Date
Msg-id 29874.1398374703@sss.pgh.pa.us
Whole thread Raw
In response to Re: Poor performance for delete query  (Jonatan Evald Buus <jonatan.buus@cellpointmobile.com>)
Responses Re: Poor performance for delete query
List pgsql-performance
Jonatan Evald Buus <jonatan.buus@cellpointmobile.com> writes:
> On 24 April 2014 22:29, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> I'd really have to bet that you forgot to index one of the referencing
>> tables.

> *That was our first thought, so we went through the child tables to check
> but apparently we missed some. (please see below for the difference in the
> explain analyze output)*

I'm confused.  Your second EXPLAIN ANALYZE looks like you fixed the
problem.  Are you still thinking there's an issue?

> Why is "order2transaction_fk" being triggered twice? Is that because
> there're two affected rows?

No, I'd have expected a delete of multiple rows to show as calls=N,
not N separate entries.

Maybe there are recursive queries buried under here somewhere?
That is, are you expecting any of the cascaded deletes to cascade further?
I don't recall exactly what EXPLAIN is likely to do with such cases.

            regards, tom lane


pgsql-performance by date:

Previous
From: Jonatan Evald Buus
Date:
Subject: Re: Poor performance for delete query
Next
From: Jonatan Evald Buus
Date:
Subject: Re: Poor performance for delete query