Re: unstable query plan on pg 16,17,18
Andrei Lepikhov <lepihov@gmail.com>
From: Andrei Lepikhov <lepihov@gmail.com>
To: Attila Soki <atiware@gmx.net>, Laurenz Albe <laurenz.albe@cybertec.at>
Cc: pgsql-performance@postgresql.org
Date: 2026-02-27T15:35:31Z
Lists: 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