Re: unstable query plan on pg 16,17,18 - Mailing list pgsql-performance

From Laurenz Albe
Subject Re: unstable query plan on pg 16,17,18
Date
Msg-id 5cd3d1e119e82e0cd79e0a55c4a9602fa3034392.camel@cybertec.at
Whole thread Raw
In response to Re: unstable query plan on pg 16,17,18  (Attila Soki <atiware@gmx.net>)
List 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



pgsql-performance by date:

Previous
From: Attila Soki
Date:
Subject: Re: unstable query plan on pg 16,17,18
Next
From: Andrei Lepikhov
Date:
Subject: Re: unstable query plan on pg 16,17,18