Sharding a vector index that does not fit on one node, how is it typically done, and what's the query-time cost?
Describe how managed vector databases shard an index that exceeds single-node RAM, and explain the query-time consequences for QPS and p99 latency.
Random or hash based shard-by-id. Each shard runs its own ANN index. Queries scatter gather to all shards and merge top-K.
Imagine your library is too big for one room. So you split the books randomly into ten rooms, with one librarian per room. When someone asks 'find me books like this one', the question is asked to all ten librarians at once. Each librarian searches their own room and brings back their best 10 matches. Then you compare the ten lists and keep the best overall. This is fast when all librarians answer quickly. But on a busy day, if even one librarian is slow, your customer has to wait for them. Adding more rooms means more answers per minute (throughput), but it does not make any single answer faster, and the chance that at least one room is slow goes up with each new room.
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.
4 min: random hash sharding + scatter gather query + QPS scales but p99 worsens + tail at scale paper + hedged requests / shard affine routing / timeouts as mitigations + 2026 vendor architectures.
| Property | What sharding gives you | What sharding does not give you |
|---|---|---|
| QPS | Linear scaling with shard count | Same per query latency |
| Memory ceiling | Index larger than one node's RAM | Memory efficiency per vector |
| Availability | Replicas handle shard loss | Eventual-consistency guarantees by default |
| p99 latency | Worse with more shards (tail at scale) | Lower per query latency |
| Tenant isolation | Shard-affine routing if partition keys are used | Free isolation; you must design it in |
Real products, models, and research that use this idea.
- Pinecone's pod model shards the corpus across pods of fixed RAM; serverless tier shards across stateless query nodes pulling from object storage. Both use random shard assignment with hedged reads.
- Milvus separates the architecture into data, index, query, and coordinator nodes. Sharding is at the segment level; partition keys allow shard affine routing for multi tenant workloads.
- Vespa, used at Yahoo and Spotify for over a decade, shards content groups with internal redundancy. Documented tail latency mitigations include hedged requests and timeout bounded queries.
- Google's 2013 'Tail at Scale' paper by Jeff Dean and Luiz Barroso is the canonical analysis of fan out tail latency and the techniques (hedged requests, tied requests) used to mitigate it. The patterns transfer directly to vector DB sharding.
What an interviewer would ask next. Try answering before peeking at the approach.
QWhy is the maximum of N percentile higher than the individual shards' percentile?
QWhat is the cost of hedged requests, and when is it worth paying?
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.
Believing that adding shards reduces per query latency. It reduces per shard work but not the wall clock time, because the query waits for the slowest shard.
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.