From: amano-kenji (@amano-kenji) <noreply+amano-kenji@github.com>
To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>
Subject: Re: [pgvector/pgvector] issue #796: Horizontal scalability (with citus)
Date: Sat, 08 Mar 2025 02:26:45 +0000
Message-ID: <gh-pgvector-pgvector-796-c2707907552@github.com> (raw)
In-Reply-To: <gh-pgvector-pgvector-796@github.com>
References: <gh-pgvector-pgvector-796@github.com>
Upon further inspection, it seems citus will parallelize node operations before aggregating the results at the coordinator. I suspect citus is going to be faster than postgres_fdw, but I haven't really tested.
Update: citus doesn't support custom sharding methods. postgres_fdw doesn't support parallel MergeAppend plans. I guess you are forced to roll your own sharding solution at the application level. If your application implements its own PostgreSQL pgvector sharding mechanism, it will bypass citus, postgres_fdw, and other existing horizontal scaling solutions.
Update 2: I can calculate a shard key from a vector embedding and other information. Then, I can put the shard key in a table column. Citus can use this. I guess I can calculate a few relevant shards for a vector embedding. By narrowing down the number of shards you deal with for each vector embedding, you can reduce the load on postgres.