Filtered vector search at multi-tenant scale
Problem
Production traces showed vector search at a 2,087 ms median and 4,073 ms at p95, with wide swings between adjacent requests. The HNSW index is global, so a project filter either dropped most results or pushed Postgres into a sequential scan.
What we did
We enabled pgvector's iterative scan so the graph search keeps expanding until enough results survive the filter. We used relaxed ordering, because the re-ranker re-sorts every result anyway and strict ordering would have bought nothing.
Result
Retrieval stopped being the bottleneck. Later tracing put most of the roughly 3.5-second median in the model call.



