Re: explain vs auto_explain - Mailing list pgsql-general

From Vijaykumar Jain
Subject Re: explain vs auto_explain
Date
Msg-id CAM+6J97N7RY0WQg2u8qiEUhOKPVgZ=fO835CYdRkGoJ3TzCJmw@mail.gmail.com
Whole thread Raw
In response to Re: explain vs auto_explain  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: explain vs auto_explain
List pgsql-general


On Sat, 19 Oct 2024 at 23:31, Tom Lane <tgl@sss.pgh.pa.us> wrote:
"David G. Johnston" <david.g.johnston@gmail.com> writes:
> On Sat, Oct 19, 2024 at 10:43 AM Vijaykumar Jain <
> vijaykumarjain.github@gmail.com> wrote:
>> i tried to check the code for auto_explain , there is nothing that helps
>> understand why it was provided as a separate .

> Probably because output to log was easier than reworking the internals to
> make output to client happen.

The reason that auto_explain exists is to capture plans for queries
that are being issued by real applications --- which aren't programmed
to issue EXPLAIN for themselves, and likely don't have a good place to
put the data if they did.  Also, auto_explain can capture runtime
details for queries that are really being executed and delivering
results, whereas EXPLAIN ANALYZE doesn't deliver the query results and
thus can't be shoehorned into real applications.  So it's partly a
matter of not having a protocol spec that would allow the EXPLAIN data
to be delivered on a side channel, but mostly a recognition that
rewriting applications to capture such data would be painful.

                        regards, tom lane

ok, it makes sense for the reason of having auto_explain. but maybe i did ask correctly, 
why do we not have the extended flags in auto_explain , in , explain wrt nested_statements, and triggers ...
a user who finds the console output complicated, could well use a pager or redirect the output to the file via \o which is client side.

as i mentioned the reason is, there are differences on what auto_explain captures and what explain does... and the dev user is not able to see the difference
without having access to logs.
for example , iirc 
refresh materialised view does not show the plan , although there was once a feature reported, which showed the difference in support for parallelism.
ex in this discussion

i dont expect this to be a feature request or something, it was just that i wanted to be aware why there are differences,
 because the cloud guys have strict control over logs as it has many other things, so they just wont give access at all.


--
Thanks,
Vijay

Open to work
Resume - Vijaykumar Jain

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: explain vs auto_explain
Next
From: Vijaykumar Jain
Date:
Subject: Re: explain vs auto_explain