public inbox for [email protected]
help / color / mirror / Atom feedFrom: Adrian Klaver <[email protected]>
To: veem v <[email protected]>
Cc: pgsql-general <[email protected]>
Subject: Re: Debugging query performance in postgres
Date: Thu, 4 Sep 2025 14:20:34 -0700
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAB+=1TV0ywL3kCnVO-MA8XDWzrMRB5m5ZC9jADPwT=o-YECKwA@mail.gmail.com>
References: <CAB+=1TWW+iPTtH-P+-b8CdS0fPvt2+8B7OQ5gS9ostuoPvMJqg@mail.gmail.com>
<[email protected]>
<CAB+=1TV0ywL3kCnVO-MA8XDWzrMRB5m5ZC9jADPwT=o-YECKwA@mail.gmail.com>
On 9/4/25 13:32, veem v wrote:
>
> On Thu, 4 Sept 2025 at 23:19, Adrian Klaver <[email protected]
>
> 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.
Did you do an EXPLAIN ANALYZE before and after the changes?
If so did you save the results and can you share them?
> The version is 16.
> Yes, autovacuum running.
> We don't have any major changes.
Except for the performance degradation, so something changed.
> 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?
The pg_stat_statements view has the following fields(among others):
min_exec_time double precision
max_exec_time double precision
mean_exec_time double precision
minmax_stats_since timestamp with time zone
I could see a cron job that gathers the above data at regular intervals.
Then you could track the query performance at a rough level.
--
Adrian Klaver
[email protected]
view thread (5+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected]
Subject: Re: Debugging query performance in postgres
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox