From: jkatz (@jkatz) <noreply+jkatz@github.com>
To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>
Subject: Re: [pgvector/pgvector] PR #424: Update cost estimation to not use index when expected tuples is too low
Date: Sun, 21 Jan 2024 23:08:35 +0000
Message-ID: <gh-pgvector-pgvector-424-c1902797274@github.com> (raw)
In-Reply-To: <gh-pgvector-pgvector-424@github.com>
References: <gh-pgvector-pgvector-424@github.com>
Left some minor stylistic comments.
I'm still thinking through this one and need to test. I primarily stared at HNSW for a bit. I agree with the initial clause that if there's no limit, then don't use the index. However, I'm still grappling with a few concepts:
* Selectivity is low but the column in question is not indexed, which could yield a faster pgvector index scan. OTOH, that still could yield results that are not relevant. There's an argument that the other column should be indexed, but we can't necessarily assume that doing so makes sense for that domain. This leads to...
* Impact on HQANN, where in theory selectivity is low but we want a targeted scan through the index
I think for a bunch of cases, HQANN would help produce a fast in absence of an alternative filter. I saw an example with a `LIKE '%...%'` where that selectivity score would matter more. But as mentioned, I'm still thinking / looking for ideas on the above.