Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Get explain plan while query running

11 views
Skip to first unread message

Rich Ford

unread,
Mar 10, 2022, 11:31:24 AM3/10/22
to
Is there a way to get the explain plan for a running query as opposed to having to wait for the query to complete which is the case when using EXPLAIN.

I know in Oracle there is DBMS_XPLAN and wondering if something similar in PostgreSQL. We have looked at auto_explain but this requires a cluster reboot and this is production and we have no downtime.

This is Aurora PostgreSQL 12.6.

Rich

George Neuner

unread,
Mar 11, 2022, 10:04:23 AM3/11/22
to
On Thu, 10 Mar 2022 08:31:23 -0800 (PST), Rich Ford
<richf...@gmail.com> wrote:

>Is there a way to get the explain plan for a running query as opposed
>to having to wait for the query to complete which is the case when
>using EXPLAIN.

AFAIK, if you do /not/ specify analyze, explain only returns the plan
and does not also execute the query. However, without analyze the
estimates of cost may be wildly inaccurate if statistics on the tables
and indexes are not up to date.


>I know in Oracle there is DBMS_XPLAN and wondering if something
>similar in PostgreSQL. We have looked at auto_explain but this
>requires a cluster reboot and this is production and we have no
>downtime.
>
>This is Aurora PostgreSQL 12.6.

[Assuming this has something to do with your previous post]
auto_explain won't help anyway if you can't wait for the problem
queries to execute.


George
0 new messages