Re: On disable_cost

From: "Jonathan S(dot) Katz" <jkatz(at)postgresql(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, David Rowley <dgrowleyml(at)gmail(dot)com>, Peter Geoghegan <pg(at)bowt(dot)ie>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, andrew(at)ankane(dot)org
Subject: Re: On disable_cost
Date: 2024-08-23 21:44:37
Message-ID: accc879c-8a7e-4e61-9ae9-6737abf35a9c@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 8/23/24 5:33 PM, Jonathan S. Katz wrote:
> On 8/23/24 3:32 PM, Tom Lane wrote:
>> Robert Haas <robertmhaas(at)gmail(dot)com> writes:

>> I think it's not that bad, because we can limit the knowledge of this
>> hack to the amcostestimate interface, which doesn't really deal in
>> "the user told us not to do it this way" at all.  That argues against
>> my first proposal though (having amcostestimate touch disabled_nodes
>> directly).  I now think that a reasonable compromise is to say that
>> setting indexTotalCost to +Inf signals that "the AM cannot support
>> it".  That's not conflated too much with the other case, since even a
>> crazy-expensive cost estimate surely ought to be finite.  We can have
>> cost_index untangle that case into a separate failure return so that
>> the within-the-core-optimizer APIs remain clean.
>>
>> While that would require hnsw to make a small code change (return
>> +Inf not DBL_MAX), that coding should work in back branches too,
>> so they don't even need a version check.
>
> +1 for this approach (I'll do a quick test in my pgvector workspace just
> to ensure it gets the same results in the older version).

...and I confirmed the +inf approach on PG16 +pgvector does still give
the same expected result.

Thanks,

Jonathan

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Joel Jacobson 2024-08-23 22:00:30 Re: Optimising numeric division
Previous Message Tom Lane 2024-08-23 21:39:40 Re: [PATCH] Guard `CLOBBER_FREED_MEMORY` & `MEMORY_CONTEXT_CHECKING`