Re: unstable query plan on pg 16,17,18

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: Attila Soki <atiware(at)gmx(dot)net>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: unstable query plan on pg 16,17,18
Date: 2026-02-23 21:44:00
Message-ID: 5cd3d1e119e82e0cd79e0a55c4a9602fa3034392.camel@cybertec.at
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Mon, 2026-02-23 at 22:19 +0100, Attila Soki wrote:
> To "switch" between the ok and wrong plans I execute
> vacuumdb -Upostgres -vZ -t schema1.table_k db1
> multiple times (1x-3x) until the plan flips. So I thought the table should already have been analyzed.
> In my first email I called table_k as the "tbl_used_in_query"

Ok, I see. Then a simple ANALYZE won't do.

Perhaps the column needs more detailed statistics?

ALTER TABLE schema1.table_k ALTER dp_end_dat SET STATISTICS 1000;
ANALYZE schema1.table_k (dp_end_dat);

> or have I misunderstood that with the analyze?

No; I missed that point.

Yours,
Laurenz Albe

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Andrei Lepikhov 2026-02-24 09:11:15 Re: unstable query plan on pg 16,17,18
Previous Message Attila Soki 2026-02-23 21:19:33 Re: unstable query plan on pg 16,17,18