From: cschanhniem (@cschanhniem) <noreply+cschanhniem@github.com>
To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>
Subject: Re: [pgvector/pgvector] issue #761: Enhancement: multicolumn vector index design
Date: Thu, 18 Jun 2026 19:14:38 +0000
Message-ID: <gh-pgvector-pgvector-761-c4745341174@github.com> (raw)
In-Reply-To: <gh-pgvector-pgvector-761@github.com>
References: <gh-pgvector-pgvector-761@github.com>
[@IgnazioDS](https://github.com/IgnazioDS) Re: your tenant_id uniformity question — the degradation pattern is predictable from the index structure. When filter columns have high cardinality but low correlation with vector clusters, mc_hnsw (and ACORN) both face the same fundamental limit: the filter partition and the vector partition live in orthogonal dimensions.
For mc_hnsw specifically, the index stores tuples as `(filter_key, vector, heap_tid)` and navigates by filter_key first, then by vector distance within the filtered subset. When tenant_id is uniformly distributed across the embedding space (the low-correlation case), each filter partition is essentially a random sample of the full HNSW graph — so mc_hnsw degrades to "HNSW with post-filtering" at the per-tenant level, just with the post-filter happening inside the index AM rather than at the executor level.
The win is architectural, not algorithmic at that point: you avoid fetching and discarding non-matching tuples from shared buffers, which matters when `effective_cache_size` is small relative to the index. If all data fits in shared buffers anyway, mc_hnsw and relaxed-pgvector converge to the same wall-clock performance at very low correlation.
The hybrid retrieval case (pgvector + BM25) actually plays well with mc_hnsw precisely because BM25 already needs the filter selectivity to be low — you don not want your sparse query matching 100K rows and then fusing with dense. MC index keeps both the filter and the vector search inside the AM, which makes the BM25+vector dual path cheaper: the sparse side runs as a btree/gin scan on the filter column, the dense side runs mc_hnsw on the same filter partition, and the RRF merge happens at the executor with both sides already filtered. Without mc_hnsw, the dense side has to post-filter or use relaxed, both of which add overhead that mc eliminates for the `field = value` case.