Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.databases.postgresql > #904 > unrolled thread

Get explain plan while query running

Started byRich Ford <richford990@gmail.com>
First post2022-03-10 08:31 -0800
Last post2022-03-11 10:04 -0500
Articles 2 — 2 participants

Back to article view | Back to comp.databases.postgresql


Contents

  Get explain plan while query running Rich Ford <richford990@gmail.com> - 2022-03-10 08:31 -0800
    Re: Get explain plan while query running George Neuner <gneuner2@comcast.net> - 2022-03-11 10:04 -0500

#904 — Get explain plan while query running

FromRich Ford <richford990@gmail.com>
Date2022-03-10 08:31 -0800
SubjectGet explain plan while query running
Message-ID<1add5218-f1fa-4e34-a5ee-a399c19c6c1bn@googlegroups.com>
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

[toc] | [next] | [standalone]


#905

FromGeorge Neuner <gneuner2@comcast.net>
Date2022-03-11 10:04 -0500
Message-ID<2eom2ht13dh49i3lqqjponfj5cajsl4i72@4ax.com>
In reply to#904
On Thu, 10 Mar 2022 08:31:23 -0800 (PST), Rich Ford
<richford990@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

[toc] | [prev] | [standalone]


Back to top | Article view | comp.databases.postgresql


csiph-web