From: | veem v <veema0000(at)gmail(dot)com> |
---|---|
To: | Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> |
Cc: | pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Debugging query performance in postgres |
Date: | 2025-09-04 20:32:28 |
Message-ID: | CAB+=1TV0ywL3kCnVO-MA8XDWzrMRB5m5ZC9jADPwT=o-YECKwA@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Thu, 4 Sept 2025 at 23:19, Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
wrote:
> On 9/4/25 09:57, veem v wrote:
> > Hello,
> > We have a situation in which we had a dml query within a procedure that
> > was running fine but suddenly the plan flipped and it started running
> > longer. It took us a good amount of time to identify the cause and fix
> > it. So I have below questions,
>
> What was the cause?
>
> Postgres version
>
> Was there any major changes in the database e.g schema changes or
> quantity of data?
>
> Is autovacuum running?
>
> > 1)Do we have any data dictionary view or query available which gives us
> > information on what were the queryids those are executing from within a
> > procedure and how much time they are taking?
> > 2)Also how to identify , if any specific queries has opted a different
> > plan today as compared to past executions and also response time
> > increased because of that?
>
> Take a look at:
>
> https://www.postgresql.org/docs/current/pgstatstatements.html
>
>
We didn't get the exact root cause why the plan flipped but we have to add
additional filters to get rid of the performance issue.
The version is 16.
Yes, autovacuum running.
We don't have any major changes. But if there was a significant change in
quantity of data , Yet to check that.
The pg_stats_statement does show the execution stats of the individual
query execution , but doesnt show any historical plan deviation. Also the
individual procedure and sql statement are logged into this view but i was
wondering if there is an easy way to relate the sql text of the procedure
with the underlying sqls running within the procedure?
From | Date | Subject | |
---|---|---|---|
Next Message | Adrian Klaver | 2025-09-04 21:20:34 | Re: Debugging query performance in postgres |
Previous Message | Adrian Klaver | 2025-09-04 20:16:20 | Re: Q: limit the length of log file entries? |