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