Re: Query planner instability on large append-only table with heavy same-day inserts - Mailing list pgsql-general

From Laurenz Albe
Subject Re: Query planner instability on large append-only table with heavy same-day inserts
Date
Msg-id 48cacb3c6e564e83ff67d7925d75488b79d74dba.camel@cybertec.at
Whole thread Raw
In response to Query planner instability on large append-only table with heavy same-day inserts  (Giriraj Sharma <giriraj.sharma27@gmail.com>)
List pgsql-general
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
werun 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



pgsql-general by date:

Previous
From: Wim Rouquart
Date:
Subject: RE: Index (primary key) corrupt?
Next
From: Greg Sabino Mullane
Date:
Subject: Re: Index (primary key) corrupt?