=?UTF-8?Q?Felipe_L=C3=B3pez_Montes?= <xoca...@gmail.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