Re: Incomplete Explain for delete - Mailing list pgsql-bugs

From Tom Lane
Subject Re: Incomplete Explain for delete
Date
Msg-id 4794.1434989988@sss.pgh.pa.us
Whole thread Raw
In response to Re: Incomplete Explain for delete  ("David G. Johnston" <david.g.johnston@gmail.com>)
Responses Re: Incomplete Explain for delete
List pgsql-bugs
"David G. Johnston" <david.g.johnston@gmail.com> writes:
> On Mon, Jun 22, 2015 at 11:47 AM, Ghislain ROUVIGNAC <ghr@sylob.com> 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

pgsql-bugs by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: Incomplete Explain for delete
Next
From: "David G. Johnston"
Date:
Subject: Re: Incomplete Explain for delete