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: Tue, 12 Sep 2023 11:43:41 +0000
Message-ID: <gh-pgvector-pgvector-259-c1715567010@github.com> (raw)
In-Reply-To: <gh-pgvector-pgvector-259@github.com>
References: <gh-pgvector-pgvector-259@github.com>

TL;DR The feasible way is to have filtering data in the same index with vectors.

@jkatz I may be wrong but I suppose that the main problem of using bitmap scan would be that the result of bitmap AND query is proper only if ordering is done after BitmapAnd node (that's likely the reason that Bitmap scan node doesn't get ORDER BY clause). But after BitmapAnd we don't have index data anymore to do efficient ANN. 

Otherwise, if we have ANN before BitmapAnd we'll get only a small number of nearest-neighbors into bitmap (while it's supposed to have all tuples). We are likely to wrongly get no tuples after BitmapAnd at all. To avoid this we need to have a sufficient (how many is sufficient?) amount of tuples after ANN. I think that's not how filtering by another attribute should work.

So, IMO we can't use bitmap scan to do this kind of filtering.

The closest way to do this kind of filtering could be by implementing a covering index with filtering by the included column during index scan


view thread (90+ messages)  latest in thread

Message-ID: <gh-pgvector-pgvector-259-c1715567010@github.com>
Permalink:  ../gh-pgvector-pgvector-259-c1715567010@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