Re: Indexes on expressions with multiple columns and operators

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Frédéric Yhuel <frederic(dot)yhuel(at)dalibo(dot)com>
Cc: "pgsql-performance(at)lists(dot)postgresql(dot)org" <pgsql-performance(at)lists(dot)postgresql(dot)org>, Jehan-Guillaume de Rorthais <jgdr(at)dalibo(dot)com>, Christophe Courtois <christophe(dot)courtois(at)dalibo(dot)com>, Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
Subject: Re: Indexes on expressions with multiple columns and operators
Date: 2025-09-18 15:32:29
Message-ID: 1916727.1758209549@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-performance

=?UTF-8?Q?Fr=C3=A9d=C3=A9ric_Yhuel?= <frederic(dot)yhuel(at)dalibo(dot)com> writes:
> On 9/17/25 16:41, Tom Lane wrote:
>> =?UTF-8?Q?Fr=C3=A9d=C3=A9ric_Yhuel?= <frederic(dot)yhuel(at)dalibo(dot)com> writes:
>>> 2) the number of estimated rows is completely off in the second EXPLAIN,
>>> whereas the planner could easily use the statistics of foo_f_idx.

>> Hmm, not sure about that. Again, boolean-valued indexes aren't
>> something we've worked on too hard, but I don't see why that
>> would affect this case.

> OK, thanks anyway, I think the ju-jitsu mentioned above will do, even
> though the application code will have to be patched.

Sigh ... so the answer is this used to work (since commit 39df0f150)
and then I carelessly broke it in commit a391ff3c3. If you try this
test case in versions 9.5..11 you get a spot-on rowcount estimate.
Serves me right for not having a test case I guess, but I'm astonished
that nobody complained sooner.

regards, tom lane

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2025-09-18 16:40:39 Re: Indexes on expressions with multiple columns and operators
Previous Message Jehan-Guillaume de Rorthais 2025-09-18 15:26:28 Re: Indexes on expressions with multiple columns and operators