Compare namespace-per-tenant against single-shared-index-with-tenant-filter for a B2B RAG product serving 5000 customers.
A B2B RAG product has 5000 customer tenants ranging from 10 documents to 500k documents each. Compare the two main multi-tenancy patterns for the vector layer (namespace-per-tenant vs single shared index with a tenant_id filter). Cover correctness, cost, noisy neighbor risk, and the small-tenant cold start problem.
Namespace-per-tenant gives strong isolation but pays per tenant overhead, hurting small tenants. Shared-index-with-filter amortizes cost but hits the filter broken recall HNSW pitfall and noisy neighbor risk.
Imagine you run a self-storage facility, and 5000 small businesses are renting space in your search system. **Option A: a separate room per tenant.** Their stuff is totally separated; nobody can peek; you can clear out a tenant by emptying their room. But you pay rent on 5000 rooms, and many of them are nearly empty. **Option B: one giant warehouse with everyone's stuff mixed and tagged with stickers.** Cheaper rent overall, but when a small tenant asks for their stuff, you have to search through the whole warehouse looking for their sticker, and sometimes the warehouse layout makes you miss their items. **The answer in real life:** put your three biggest tenants (who fill the warehouse) in their own rooms anyway, and pool the other 4997 into the shared warehouse.
Detailed answer & concept explanation~4 min readEverything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
5 min: walk through both pure patterns + filter broken recall pitfall + heavy-tail distribution argument + layered hybrid recommendation + 2026 vendor primitives.
| Concern | Namespace per tenant | Shared index + filter | Hybrid |
|---|---|---|---|
| Isolation | Strong | Filter-only (not a security boundary) | Strong for whales, filter for tail |
| Per tenant cost | Constant overhead (bad for small tenants) | Amortized | Right-sized per tier |
| Cold-start | Bad for tiny tenants | Non-issue | Solved per tier |
| Noisy-neighbor | Bounded per index | Cross-tenant interference | Bounded for whales, pooled for tail |
| GDPR delete | Drop one collection | Scan + tombstone (expensive) | Drop for whales, scan-filtered for tail |
| HNSW recall safety | Always good | Filter-broken-recall risk | Good for whales; mitigated by filterable HNSW for tail |
Real products, models, and research that use this idea.
- Pinecone's multi-tenancy guide explicitly recommends the hybrid: namespaces for high volume tenants, shared index with tenant_id filter for the long tail.
- Qdrant added tenant partitioned payload indexing to mitigate filter broken recall in shared collections.
- Weaviate has multi-tenancy as a first-class feature on classes with active tenant memory residency.
- Vespa's filterable HNSW implements graph level filter awareness so selective filters don't strand the walk.
- Notion, Glean, and similar B2B RAG products publicly describe layered tenant tiers (whales / mid tail / long tail) in engineering talks.
What an interviewer would ask next. Try answering before peeking at the approach.
QHow does Qdrant payload indexed search mitigate filter broken recall?
QWhat is the cost of GDPR 'forget this tenant' in each pattern?
Don't say thisRed flags and common mistakes that signal junior thinking. Click to expand.
Red flags and common mistakes that signal junior thinking. Click to expand.
Picking 'shared index with tenant_id filter' as universally right because it sounds efficient, without noticing that HNSW with a selective metadata filter is exactly the configuration that returns fewer than K results.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.
Same topic, related formats. Practice these next.