pg.ddx.io  pgvector/pgvector GitHub issues and pull requests  
help / color / mirror / Atom feed
From: knizhnik (@knizhnik) <noreply+knizhnik@github.com>
To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>
Subject: Re: [pgvector/pgvector] issue #259: Understanding HNSW + filtering
Date: Tue, 07 Nov 2023 06:42:12 +0000
Message-ID: <gh-pgvector-pgvector-259-c1797906092@github.com> (raw)
In-Reply-To: <gh-pgvector-pgvector-259@github.com>
References: <gh-pgvector-pgvector-259@github.com>

I just want to notice that the proposed approach (with `(embedding vector_l2_ops, category_id)` index) will work only f when query contains exact match predicate for category, i.e.
```
SELECT ... WHERE category_id = 1234 ORDER BY embedding <-> $1;
```
It will not work (index can not be applied) in the following cases:
```
SELECT ... WHERE category_id in (1,2,3,4) ORDER BY embedding <-> $1;
SELECT ... WHERE category_id > 1234 ORDER BY embedding <-> $1;
SELECT ... ORDER BY embedding <-> $1;
```

Certainly we can merge results obtained  from multiple indexes. But it leads to a lot of redundant work and in case where there is not restriction on category becomes extremely ineffcieint.

view thread (90+ messages)  latest in thread

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