From: jkatz (@jkatz) <noreply+jkatz@github.com>
To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>
Subject: Re: [pgvector/pgvector] PR #682: Update HNSW cost estimatation to utilize search and index info
Date: Wed, 25 Sep 2024 19:20:06 +0000
Message-ID: <gh-pgvector-pgvector-682-c2375032367@github.com> (raw)
In-Reply-To: <gh-pgvector-pgvector-682@github.com>
References: <gh-pgvector-pgvector-682@github.com>
@ankane Pushed changes inline with feedback. One discussion point will be the check to push the costs up to the max if tuples is 0.
I'm...OK-ish to go with your suggestion (add `1` to the total number), but arguably if we have no tuples, we shouldn't even bother considering the index scan. Adding 1 is certainly a cheap operation, but it'd be cheaper in that case to not even go through all the operations. OTOH, we then have to check that condition every time, and given it's unlikely we'd encounter that case (UPDATE: I added an `unlikely` clause), it may just be better to "add 1".