Re: Incomplete Explain for delete

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: Ghislain ROUVIGNAC <ghr(at)sylob(dot)com>, "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: Incomplete Explain for delete
Date: 2015-06-22 16:19:48
Message-ID: 4794.1434989988@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

"David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> writes:
> On Mon, Jun 22, 2015 at 11:47 AM, Ghislain ROUVIGNAC <ghr(at)sylob(dot)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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message David G. Johnston 2015-06-22 16:41:28 Re: Incomplete Explain for delete
Previous Message David G. Johnston 2015-06-22 16:07:54 Re: Incomplete Explain for delete