From: ankane (@ankane) <noreply+ankane@github.com>
To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>
Subject: Re: [pgvector/pgvector] issue #796: Horizontal scalability (with citus)
Date: Fri, 07 Mar 2025 17:08:49 +0000
Message-ID: <gh-pgvector-pgvector-796-c2706976491@github.com> (raw)
In-Reply-To: <gh-pgvector-pgvector-796@github.com>
References: <gh-pgvector-pgvector-796@github.com>
Hi @amano-kenji, sharding with same options will increase recall, not decrease it (please test this yourself before creating an issue for it).
If you need to search the entire table, it'll need to search all shards. Otherwise, you can specify a distribution column and Citus will only query a single shard (see [this example](https://github.com/pgvector/pgvector-python/blob/master/examples/citus/example.py) - add `category_id` to query a single shard).
Edit: You could also assign vectors to shards using a similar approach to IVFFlat and only search the closest shards to the query vector (this could be implemented at the application level on top of pgvector).