Re: PostgreSQL Choosing Full Index Over Partial Index

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Felipe López Montes <xocas89(at)gmail(dot)com>
Cc: pgsql-performance(at)lists(dot)postgresql(dot)org
Subject: Re: PostgreSQL Choosing Full Index Over Partial Index
Date: 2025-04-30 14:14:04
Message-ID: 1287724.1746022444@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-performance

=?UTF-8?Q?Felipe_L=C3=B3pez_Montes?= <xocas89(at)gmail(dot)com> writes:
> Thanks a lot for your response Tom.
> May I ask how do you debug those functions?
> Or is it just that you read the code and more or less guess what should be
> the value for each variable with information coming from querying Postgres
> tables?

The guessing was in building a test case, since you didn't provide
a self-contained reproducer...

Once I had a case where the estimated cost was smaller for the larger
index, I just worked through the code to see where the costs diverged.
It helped that I already know the structure of that code well, but
there wasn't guesswork involved, other than where to set breakpoints
to narrow down the source more quickly.

I forgot to mention on this thread that I posted a possible fix at
[1].

regards, tom lane

[1] https://www.postgresql.org/message-id/870686.1745860834%40sss.pgh.pa.us

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Leo 2025-05-02 14:23:07 Vacuum Questions
Previous Message Felipe López Montes 2025-04-30 09:11:14 Re: PostgreSQL Choosing Full Index Over Partial Index