Walk through sharding a vector database from 50 million toward 500 million vectors
Your single-node vector database is at 50 million vectors with degrading p99 latency, and the roadmap points at 500 million. Walk through how you would shard it: the partitioning choice, how queries execute across shards, and what gets worse the moment you go distributed.
Shard by tenant if queries are scoped, hash and scatter-gather if global. Tail latency, per-shard ANN tuning, rebalancing, and hybrid score fusion all get worse the moment you go distributed.
Imagine a library that outgrew one building. You can split it two ways. Option one: give each company its own building. Most visitors only need their company's books, so they go to one building and life is fast. Option two: spread all books across many buildings randomly. Now every visitor sends helpers to all buildings, each helper grabs the best matches, and they meet at the door to pick the overall best. This is slower because the slowest helper sets the pace. The trick is choosing which split matches how people actually search, and then accepting that p99 latency, recall tuning, and rebalancing all get harder no matter which choice you make.
Detailed answer & concept explanation~6 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.
8 min: memory math forces the move, choose partitioning from the query shape, plan for slowest-shard tail latency, tune per-shard ANN and k, plan rebalancing and reindexing from day one.
Real products, models, and research that use this idea.
- Pinecone serverless and pod-based architectures expose namespace and metadata partitioning specifically for tenant sharding
- Weaviate and Qdrant support multi-tenancy with per-tenant collections that map cleanly to scoped queries
- Milvus and Vespa support scatter-gather across segments for genuinely global queries, with per-segment recall tuning
- AWS OpenSearch with k-NN and Azure AI Search both implement sharded vector indexes with router-side merging
- Chroma and pgvector at scale typically lean on the underlying storage engine (Postgres, etc.) for sharding rather than building it themselves
What an interviewer would ask next. Try answering before peeking at the approach.
QHow would you handle a hot tenant in a tenant-sharded layout?
QWhat does per-shard recall tuning look like in practice?
QHow do you do hybrid search across shards safely?
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.
Hash-sharding when queries are tenant-scoped, which forces scatter-gather across every shard for what could have been a one-shard lookup, paying tail latency for no benefit.
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.