pg.ddx.io  pgvector/pgvector GitHub issues and pull requests  
help / color / mirror / Atom feed
From: pashkinelfe (@pashkinelfe) <noreply+pashkinelfe@github.com>
To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>
Subject: Re: [pgvector/pgvector] issue #259: Understanding HNSW + filtering
Date: Wed, 20 Sep 2023 19:51:01 +0000
Message-ID: <gh-pgvector-pgvector-259-c1728337137@github.com> (raw)
In-Reply-To: <gh-pgvector-pgvector-259@github.com>
References: <gh-pgvector-pgvector-259@github.com>

@jkatz 

> It may expand the search radius, but we may not be seeing the best available vectors for a filter. For example, let's say that vectors with a specific filter (category_id=5) are clustered around a particularly neighborhood that's not actually close to the query vector -- if we expand the search, we may end up exhaustively searching the index until we find the best candidate vectors.

I agree that filtering without this would always be a compromise that will fail to output proper results if a filtering attribute will reject the number of nodes passing the filter significantly. So we need to build `M*Ncat` links where `Ncat` is the number of possible filtering categories (instead of existing HNSW parameter of number of links per node `M`). The number of links is not expected to bloat the index much as multidimensional vector size is big enough compared to `M` (or `M*Ncat`) links. But strictly implementing this we can get adding new values of `category_id` to be resource resource-intensive.

Automatically repeating search with increased ef_search if we get less vector, as @knizhnik proposed in https://github.com/pgvector/pgvector/pull/266, I think is a different and easier optimization that can help with getting less results from HNSW due to dead tuples in the heap. I think it's safe enough to be included. 

view thread (90+ messages)  latest in thread

Message-ID: <gh-pgvector-pgvector-259-c1728337137@github.com>
Permalink:  ../gh-pgvector-pgvector-259-c1728337137@github.com/

 · 


This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox