Sharding a vector index that does not fit on one node, how is it typically done, and what's the query-time cost?
Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
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.
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.
What an interviewer would ask next. Try answering before peeking at the approach.
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.