Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZwtvW-0003On-3Y for pgsql-performance@arkaria.postgresql.org; Thu, 12 Nov 2015 15:36:42 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZwtvV-0000mq-FM for pgsql-performance@arkaria.postgresql.org; Thu, 12 Nov 2015 15:36:41 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZwtvU-0000ll-RN for pgsql-performance@postgresql.org; Thu, 12 Nov 2015 15:36:40 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZwtvS-0004RK-8s for pgsql-performance@postgresql.org; Thu, 12 Nov 2015 15:36:40 +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 tACFaZe6014811; Thu, 12 Nov 2015 10:36:35 -0500 From: Tom Lane To: Merlin Moncure cc: Massalin Yerzhan , postgres performance list Subject: Re: Simple delete query is taking too long (never ends) In-reply-to: References: <17089.1447270415@sss.pgh.pa.us> Comments: In-reply-to Merlin Moncure message dated "Thu, 12 Nov 2015 09:12:51 -0600" Date: Thu, 12 Nov 2015 10:36:35 -0500 Message-ID: <14810.1447342595@sss.pgh.pa.us> X-Pg-Spam-Score: -2.3 (--) 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 Merlin Moncure writes: > On Wed, Nov 11, 2015 at 1:33 PM, Tom Lane wrote: >> If you're not sure which table is the problem, try doing an EXPLAIN >> ANALYZE of a DELETE that will only remove a few rows. You should >> see some time blamed on a trigger associated with the FK constraint. > You've answered this question (with the same answer) what feels like a > gazillion times. I guess the underlying problem is that EXPLAIN is, > uh, not explaining things very well. In principle, a plain EXPLAIN could list the triggers that would potentially be fired by the query, but I'm afraid that wouldn't help much. The actual performance problem is down inside the trigger, which is an opaque black box so far as EXPLAIN can possibly know. 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