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

From Andrei Lepikhov
Subject Re: unstable query plan on pg 16,17,18
Date
Msg-id 091eef0e-0271-47d1-aa47-439284e3f316@gmail.com
Whole thread Raw
In response to Re: unstable query plan on pg 16,17,18  (Attila Soki <atiware@gmx.net>)
List pgsql-performance
On 27/2/26 16:00, Attila Soki wrote:
> On 27 Feb 2026, at 09:15, Andrei Lepikhov <lepihov@gmail.com> wrote:
> I dont know the inner workings of analyze, is that normal that executing 
> analyze on unchanged data can flip the plan? Does analyze select a 
> random set of rows?

Yes, this is completely normal because ANALYZE works in a random way.
You can try using the Join-Order-Benchmark to see how running the 
ANALYZE command can change the execution time of the same query, 
sometimes by as much as ten times.

-- 
regards, Andrei Lepikhov,
pgEdge



pgsql-performance by date:

Previous
From: Attila Soki
Date:
Subject: Re: unstable query plan on pg 16,17,18
Next
From: Mauro Gatti
Date:
Subject: Planner join order regression from PG 15 to PG 16+: 70ms -> 1440ms (self-contained reproducer included)