From: jkatz (@jkatz) <noreply+jkatz@github.com>
To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>
Subject: Re: [pgvector/pgvector] issue #259: Understanding HNSW + filtering
Date: Fri, 16 Aug 2024 15:37:00 +0000
Message-ID: <gh-pgvector-pgvector-259-c2293731562@github.com> (raw)
In-Reply-To: <gh-pgvector-pgvector-259@github.com>
References: <gh-pgvector-pgvector-259@github.com>
@cho-thinkfree-com Without understanding the full scope of how you're searching, perhaps for your case you may want to consider either
1. Having a partial index on the vector column (`CREATE INDEX ON ... USING hnsw(...) WHERE (attachment = false);` (I don't know what your other conditions may be or if you're ever searching over specifically `attachment=true`, or
2. Partitioning the table by your `attachment` column, and creating the vector index on partition where `attachment` is false. (If you're also searching where `attachment = true`, you can create a vector index on that partition as well.
A B-tree index on `attachment` is unlikely going to give you much here if you're just indexing on true/false, particularly given the selectivity of your data. You're likely better off just dropping that index.