> On 29 May 2024, at 02:53, Tom Lane wrote:
>
> Alexander Staubo writes:
>> (2) Set up schema. It's important to create the index before insertion, in
>> order to provoke a
>> situation where the indexes have dead tuples:
>> ...
>> (4
On 28 May 2024, at 13:02, Laurenz Albe wrote:
> ANALYZE considers only the live rows, so PostgreSQL knows that the query will
> return only few results. So it chooses the smaller index rather than the one
> that matches the WHERE condition perfectly.
>
> Unfortunately, it has to wade through all
I am encountering an odd problem where Postgres will use the wrong index,
particularly if the table
has some dead tuples. The database affected is running 12.6, but I can also
reproduce with 16.3.
To reproduce:
(1) Disable autovacuum. This is just so we can induce a scenario where there
are lo