Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Z74Sn-0003ik-Bd for pgsql-bugs@arkaria.postgresql.org; Mon, 22 Jun 2015 16:20:49 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1Z74Sm-0003bv-9M for pgsql-bugs@arkaria.postgresql.org; Mon, 22 Jun 2015 16:20:48 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1Z74Rx-0002rX-3R for pgsql-bugs@postgresql.org; Mon, 22 Jun 2015 16:19:57 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1Z74Rq-0007FX-9j for pgsql-bugs@postgresql.org; Mon, 22 Jun 2015 16:19:55 +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 t5MGJm5G004795; Mon, 22 Jun 2015 12:19:48 -0400 From: Tom Lane To: "David G. Johnston" cc: Ghislain ROUVIGNAC , "pgsql-bugs@postgresql.org" Subject: Re: Incomplete Explain for delete In-reply-to: References: Comments: In-reply-to "David G. Johnston" message dated "Mon, 22 Jun 2015 12:07:54 -0400" Date: Mon, 22 Jun 2015 12:19:48 -0400 Message-ID: <4794.1434989988@sss.pgh.pa.us> X-Pg-Spam-Score: -3.3 (---) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org "David G. Johnston" writes: > On Mon, Jun 22, 2015 at 11:47 AM, Ghislain ROUVIGNAC wrote: >> So I think explain needs an improvement as it does not show the real plan >> used when running the query. > The underlying limitation here is that the planner does not concern itself > with triggers. > ​There is definitely room for improvement here but this complaint by itself > is not particularly influential to me.​ The black-box nature of functions > makes anything more detailed than "this table has triggers" difficult - > though maybe FK check triggers could be special-cased. Well, even if EXPLAIN special-cased FK triggers, it would have a hard time seeing the plan used for the queries done inside the triggers. It is true that if you run EXPLAIN ANALYZE, it will show you the amount of time spent in each trigger, which at least is enough to point the finger in the right direction. I realize that's not much help if the query takes so long that you can't EXPLAIN ANALYZE it :-(. I don't remember at the moment whether contrib/auto_explain is capable of capturing FK-trigger-fired queries, but if it is, that might be a possible avenue to seeing what's happening. regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs