public inbox for [email protected]
help / color / mirror / Atom feedRe: explain vs auto_explain
2+ messages / 2 participants
[nested] [flat]
* Re: explain vs auto_explain
@ 2024-10-19 17:25 David G. Johnston <[email protected]>
0 siblings, 1 reply; 2+ messages in thread
From: David G. Johnston @ 2024-10-19 17:25 UTC (permalink / raw)
To: Vijaykumar Jain <[email protected]>; +Cc: pgsql-general
On Sat, Oct 19, 2024 at 10:05 AM Vijaykumar Jain <
[email protected]> wrote:
> Why does auto_explain have extended flags to support nested statements and
> triggers whereas explain does not.
> the objects of concern have the same ownership and access, so it does not
> even sound like a security thing.
>
> or maybe it is just a format/display issue ?
> i tried to check the doc, there is no explicit mention of differences
> PostgreSQL: Documentation: 17: F.3. auto_explain — log execution plans of
> slow queries <https://www.postgresql.org/docs/current/auto-explain.html;
>
>
With auto_explain you end up producing multiple individual explains, one
for each top-level query being executed. Each one produced by auto_explain
which hooks into the point where a top-level query begins execution.
Running explain directly on a top-level query doesn't establish any of the
needed hooks to produce these additional explains. While those hooks could
be installed the output for manual explain is the single query result sent
to the client. How multiple explains could be combined into that single
output channel would need to be figured out as well. While auto_explain
uses the log file which is much simpler to use in this manner since each
auto_explain can just be told to write its output to the log and not worry
about any other considerations.
In short, there is no fundamental reason manual explain couldn't be
improved along these lines.
David J.
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: explain vs auto_explain
@ 2024-10-19 17:43 Vijaykumar Jain <[email protected]>
parent: David G. Johnston <[email protected]>
0 siblings, 0 replies; 2+ messages in thread
From: Vijaykumar Jain @ 2024-10-19 17:43 UTC (permalink / raw)
To: David G. Johnston <[email protected]>; +Cc: pgsql-general
On Sat, 19 Oct 2024 at 22:55, David G. Johnston <[email protected]>
wrote:
>
> With auto_explain you end up producing multiple individual explains, one
> for each top-level query being executed. Each one produced by auto_explain
> which hooks into the point where a top-level query begins execution.
> Running explain directly on a top-level query doesn't establish any of the
> needed hooks to produce these additional explains. While those hooks could
> be installed the output for manual explain is the single query result sent
> to the client. How multiple explains could be combined into that single
> output channel would need to be figured out as well. While auto_explain
> uses the log file which is much simpler to use in this manner since each
> auto_explain can just be told to write its output to the log and not worry
> about any other considerations.
>
> Thanks David.
The reason is, a normal db user who does not have access to logs or the db
server, will rely on what the console throws back.
as a result, they are not able to get the complete view of what is
happening ...
not sure how relevant is this context, but when i was playing with citus,
they have a flag
set citus.explain_all_tasks = 1;
which is session based and dumps the plan on all remote workers / shard
nodes right to the user, which otherwise only dumps for one node .. yes its
verbose, but it helps the user to see what was run on the shard.
Similarly, I was expecting to explain to give a full plan with nested plans
if requested back to the user in their session directly. if they dont want
the extended output, the default flags should be fine ?
Or is it the case, where there can be million rows from remote tables, and
auto_explain will log all scans for all matching rows, thereby killing the
console session or something ?
i tried to check the code for auto_explain , there is nothing that helps
understand why it was provided as a separate .
--
Thanks,
Vijay
Open to work
Resume - Vijaykumar Jain <https://github.com/cabecada;
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2024-10-19 17:43 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-10-19 17:25 Re: explain vs auto_explain David G. Johnston <[email protected]>
2024-10-19 17:43 ` Vijaykumar Jain <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox