On Mon, Jun 22, 2015 at 12:19 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> "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.
>
> > =E2=80=8BThere is definitely room for improvement here but this complai=
nt by
> itself
> > is not particularly influential to me.=E2=80=8B The black-box nature o=
f
> 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 tim=
e
> seeing the plan used for the queries done inside the triggers.
> =E2=80=8B
>
=E2=80=8BExcept that the query inside the trigger is known to system - the =
fact it
is wrapped in a trigger is an implementation detail that could, in theory,
be bypassed in order to facilitate a more meaningful explain output.
=E2=80=8BDavid J.=E2=80=8B
=E2=80=8B