pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Jonatan Evald Buus <jonatan.buus@cellpointmobile.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Poor performance for delete query
Date: Thu, 24 Apr 2014 17:25:03 -0400
Message-ID: <29874.1398374703@sss.pgh.pa.us> (raw)
In-Reply-To: <CABnF-8J9G7XfEuyV-DhUb3VkuZ_XCF=t7_okJFW7nZ1qMmi94Q@mail.gmail.com>
References: <CABnF-8Lyps8ribpp=BOFnqGEeWp2K5iuLukMo3txQ5UkgHjF7g@mail.gmail.com>
	<28604.1398371340@sss.pgh.pa.us>
	<CABnF-8J9G7XfEuyV-DhUb3VkuZ_XCF=t7_okJFW7nZ1qMmi94Q@mail.gmail.com>
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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


-- 
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance



view thread (6+ messages)  latest in thread

Message-ID: <29874.1398374703@sss.pgh.pa.us>
Permalink:  ../29874.1398374703@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/29874.1398374703@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: tgl@sss.pgh.pa.us, jonatan.buus@cellpointmobile.com
  Subject: Re: Poor performance for delete query
  In-Reply-To: <29874.1398374703@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox