public inbox for [email protected]  
help / color / mirror / Atom feed
From: Laurenz Albe <[email protected]>
To: Giriraj Sharma <[email protected]>
To: [email protected]
Subject: Re: Query planner instability on large append-only table with heavy same-day inserts
Date: Tue, 28 Oct 2025 14:02:17 +0100
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAB5vuUwa3QBFvJKCWY9PYWM8CM+Qk0XSq1R84zMjuBibVW8ccw@mail.gmail.com>
References: <CAB5vuUwa3QBFvJKCWY9PYWM8CM+Qk0XSq1R84zMjuBibVW8ccw@mail.gmail.com>

On Tue, 2025-10-28 at 12:06 +0530, Giriraj Sharma wrote:
> We are running into query planner instability on an append-only table that records daily commit information.
> The workload is heavily skewed toward the current day’s data, and query performance deteriorates periodically until we run ANALYZE.

The best approach is to run autoanalyze often enough, either by reducing
autovacuum_analyze_scale_factor for the table or (as you suggested) by
setting the parameter to 0 and using only autovacuum_analyze_threshold.

There is no way to force a certain plan in PostgreSQL, unless you are
using the pg_hint_plan extension.

Yours,
Laurenz Albe






view thread (3+ 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: Query planner instability on large append-only table with heavy same-day inserts
  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