On 8/23/24 5:33 PM, Jonathan S. Katz wrote:
On 8/23/24 3:32 PM, Tom Lane wrote:
Robert Haas <robertmh...@gmail.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

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

Reply via email to