Finding execution plan

Started by shashidhar Reddyover 2 years ago7 messagesgeneral
Jump to latest
#1shashidhar Reddy
shashidharreddy001@gmail.com

Hello All,

I have a Postgresql function scheduled to run on the database, some tines
it is taking too long than usual time, is it possible to get the execution
plan of this function or any other way to troubleshoot

#2Adrian Klaver
adrian.klaver@aklaver.com
In reply to: shashidhar Reddy (#1)
Re: Finding execution plan

On 11/3/23 10:40 AM, shashidhar Reddy wrote:

Hello All,

I have a Postgresql function scheduled to run on the database, some
tines it is taking too long than usual time, is it possible to get the
execution plan of this function or any other way to troubleshoot

You might to take a look at the contrib module:

https://www.postgresql.org/docs/current/pgstatstatements.html

"The |pg_stat_statements| module provides a means for tracking planning
and execution statistics of all SQL statements executed by a server."

#3Adrian Klaver
adrian.klaver@aklaver.com
In reply to: Adrian Klaver (#2)
Re: Finding execution plan

On 11/3/23 10:44 AM, Adrian Klaver wrote:

On 11/3/23 10:40 AM, shashidhar Reddy wrote:

Hello All,

I have a Postgresql function scheduled to run on the database, some
tines it is taking too long than usual time, is it possible to get
the execution plan of this function or any other way to troubleshoot

You might to take a look at the contrib module:

                 ^want

Show quoted text

https://www.postgresql.org/docs/current/pgstatstatements.html

"The |pg_stat_statements| module provides a means for tracking
planning and execution statistics of all SQL statements executed by a
server."

#4Bruce Momjian
bruce@momjian.us
In reply to: Adrian Klaver (#2)
Re: Finding execution plan

On Fri, Nov 3, 2023 at 10:44:12AM -0700, Adrian Klaver wrote:

On 11/3/23 10:40 AM, shashidhar Reddy wrote:

Hello All,

I have a Postgresql function scheduled to run on the database, some tines
it is taking too long than usual time, is it possible to get the execution
plan of this function or any other way to troubleshoot

You might to take a look at the contrib module:

https://www.postgresql.org/docs/current/pgstatstatements.html

"The pg_stat_statements module provides a means for tracking planning and
execution statistics of all SQL statements executed by a server."

Since he asked about execution plans, I was thinking auto_explain:

https://www.postgresql.org/docs/current/auto-explain.html

--
Bruce Momjian <bruce@momjian.us> https://momjian.us
EDB https://enterprisedb.com

Only you can decide what is important to you.

#5shashidhar Reddy
shashidharreddy001@gmail.com
In reply to: Adrian Klaver (#3)
Re: Finding execution plan

Thank you Adrian fir the reply, I am looking for something like complete
execution plan of the function just like EXPLAIN does.

On Fri, 3 Nov, 2023, 11:15 pm Adrian Klaver, <adrian.klaver@aklaver.com>
wrote:

Show quoted text

On 11/3/23 10:44 AM, Adrian Klaver wrote:

On 11/3/23 10:40 AM, shashidhar Reddy wrote:

Hello All,

I have a Postgresql function scheduled to run on the database, some tines
it is taking too long than usual time, is it possible to get the execution
plan of this function or any other way to troubleshoot

You might to take a look at the contrib module:

^want

https://www.postgresql.org/docs/current/pgstatstatements.html

"The pg_stat_statements module provides a means for tracking planning and
execution statistics of all SQL statements executed by a server."

#6Adrian Klaver
adrian.klaver@aklaver.com
In reply to: Bruce Momjian (#4)
Re: Finding execution plan

On 11/3/23 10:54 AM, Bruce Momjian wrote:

On Fri, Nov 3, 2023 at 10:44:12AM -0700, Adrian Klaver wrote:

On 11/3/23 10:40 AM, shashidhar Reddy wrote:

Hello All,

I have a Postgresql function scheduled to run on the database, some tines
it is taking too long than usual time, is it possible to get the execution
plan of this function or any other way to troubleshoot

You might to take a look at the contrib module:

https://www.postgresql.org/docs/current/pgstatstatements.html

"The pg_stat_statements module provides a means for tracking planning and
execution statistics of all SQL statements executed by a server."

Since he asked about execution plans, I was thinking auto_explain:

https://www.postgresql.org/docs/current/auto-explain.html

Yeah, that would be the better option.

#7shashidhar Reddy
shashidharreddy001@gmail.com
In reply to: Bruce Momjian (#4)
Re: Finding execution plan

Hello Bruce,

I do not see parameters starting with auto_explain. in configuration file
and also do I need to enable logging collector. Please guide me on this.

On Fri, 3 Nov, 2023, 11:24 pm Bruce Momjian, <bruce@momjian.us> wrote:

Show quoted text

On Fri, Nov 3, 2023 at 10:44:12AM -0700, Adrian Klaver wrote:

On 11/3/23 10:40 AM, shashidhar Reddy wrote:

Hello All,

I have a Postgresql function scheduled to run on the database, some

tines

it is taking too long than usual time, is it possible to get the

execution

plan of this function or any other way to troubleshoot

You might to take a look at the contrib module:

https://www.postgresql.org/docs/current/pgstatstatements.html

"The pg_stat_statements module provides a means for tracking planning and
execution statistics of all SQL statements executed by a server."

Since he asked about execution plans, I was thinking auto_explain:

https://www.postgresql.org/docs/current/auto-explain.html

--
Bruce Momjian <bruce@momjian.us> https://momjian.us
EDB https://enterprisedb.com

Only you can decide what is important to you.