Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WdR8p-0002TL-4V for pgsql-performance@arkaria.postgresql.org; Thu, 24 Apr 2014 21:25:11 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WdR8o-0000Ek-I0 for pgsql-performance@arkaria.postgresql.org; Thu, 24 Apr 2014 21:25:10 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WdR8m-0000EV-ER for pgsql-performance@postgresql.org; Thu, 24 Apr 2014 21:25:08 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WdR8j-0002ZW-A7 for pgsql-performance@postgresql.org; Thu, 24 Apr 2014 21:25:07 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id s3OLP3fU029875; Thu, 24 Apr 2014 17:25:03 -0400 From: Tom Lane To: Jonatan Evald Buus cc: pgsql-performance@postgresql.org Subject: Re: Poor performance for delete query In-reply-to: References: <28604.1398371340@sss.pgh.pa.us> Comments: In-reply-to Jonatan Evald Buus message dated "Thu, 24 Apr 2014 22:57:05 +0200" Date: Thu, 24 Apr 2014 17:25:03 -0400 Message-ID: <29874.1398374703@sss.pgh.pa.us> X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org Jonatan Evald Buus writes: > On 24 April 2014 22:29, Tom Lane 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