Vector Database Scaling: Sharding, Quantization & Tradeoffs

Vector Database Scaling: Sharding, Quantization & Tradeoffs

What happens when your vector search index doubles in size overnight and your queries suddenly crawl? That moment, when a demo that felt instant turns sluggish under real traffic, is where vector database scaling stops being a theory and becomes a daily operational problem. The good news is the field has matured enough that the hard choices are well understood. The bad news is that most of those choices trade one resource for another, and picking wrong is expensive.

Why Vector Search Gets Hard at Scale

A traditional database index stays small because it stores keys. A vector index stores the vectors themselves. A single 768-dimension embedding stored as 32-bit floats takes about 3 kilobytes. Multiply that by 100 million documents and you are holding roughly 300 gigabytes of raw vectors before the index structure adds a single byte of overhead. At a billion vectors, the arithmetic stops fitting comfortably in memory.

That is the core tension. Approximate nearest neighbor (ANN) search, the family of algorithms behind almost every vector database, works by building a graph or a partition structure that lets a query skip most of the dataset. Those structures are usually kept in RAM for speed. So scaling is rarely a single problem. It is three problems stacked: fitting the index in memory, keeping query latency low, and serving enough queries per second to justify the hardware bill.

The Index Types That Decide Your Scaling Ceiling

The Index Types That Decide Your Scaling Ceiling

Before you shard anything, you should understand what your index actually costs. Two families dominate production deployments.

HNSW (Hierarchical Navigable Small World) builds a multi-layer graph where each vector links to a handful of neighbors. Queries walk the graph from a sparse top layer down to a dense bottom layer. It offers excellent recall and low latency, but the graph edges add meaningful memory overhead on top of the vectors, and building the graph is slow. HNSW is the default in many systems because it behaves well without much tuning.

IVF (Inverted File) partitions vectors into clusters using k-means and searches only the nearest clusters at query time. It uses less memory than HNSW and builds faster, but recall depends heavily on how many clusters you probe. Probe too few and you miss results; probe too many and you lose the speed advantage.

Property HNSW IVF
Memory overhead Higher (graph edges) Lower (cluster lists)
Build time Slow Faster
Recall without tuning Strong Depends on probe count
Best fit Low-latency, high-recall queries Large datasets with tunable recall

Product quantization (PQ) is the second lever. It compresses each vector into a short code, often a handful of bytes, by splitting the vector into sub-vectors and mapping each to a centroid. That can cut memory by an order of magnitude, but the compression is lossy, so recall drops. The practical pattern is to combine IVF with PQ, get the memory down, and then compensate with more probing or a reranking pass.

Sharding: Splitting Vectors Across Machines

Once a single node cannot hold the index, you shard: partition the vectors across several machines, each holding its own index. A query then fans out to every shard, and the coordinating layer merges the results and returns the top matches.

The trap here is that fan-out multiplies work. Query ten shards and each one does a full ANN search, so tail latency is set by the slowest shard. If you need the global top ten results, every shard must return its own top ten so the merger has enough candidates. Skipping that step quietly degrades recall in ways that are hard to notice until users complain about missing results.

Practical guidance from teams running these systems: shard on a key that spreads load evenly, keep shard counts modest at first, and watch for hot shards where one tenant or one popular category dominates traffic. Rebalancing a vector index is far more expensive than rebalancing a row store, because moving data means rebuilding graph structures on the destination node. Planning for growth up front beats reacting to it. (Separating tenant data in an enterprise assistant)

If you are designing the operational side of this, a recovery drill for a managed database is worth building early, since restoring a large vector index from backup is one of the slowest failure paths you will ever test.

Replication, Consistency and the Read/Write Split

Replication solves a different problem than sharding. Sharding handles capacity; replication handles availability and read throughput. Most vector databases let you keep read replicas of a shard so that query traffic spreads across copies.

The consistency question is where teams get surprised. Vector indexes are usually updated asynchronously, meaning a newly inserted vector may not be searchable for a short window. For a product search or recommendation feed, that delay is invisible. For a system where a user uploads a document and immediately searches for it, the delay becomes a bug report. Check your system’s documented behavior for insert visibility before you promise instant search.

Writes are also expensive. Every insert into an HNSW graph touches multiple neighbors and can trigger graph repairs. Bulk loading is far cheaper than streaming individual inserts, so batch your writes wherever the application allows it.

Quantization and Disk-Based Indexes: Trading Recall for Memory

When memory is the binding constraint, there are two escape routes.

The first is quantization, covered above. Scalar quantization (mapping floats to 8-bit integers) is the gentle option, typically costing a small amount of recall for a fourfold memory reduction. Binary quantization is the aggressive option, shrinking vectors to single bits and slashing memory dramatically, but it usually needs a reranking step with the original vectors to recover usable accuracy.

The second is moving the index to disk. Disk-based ANN approaches keep a compressed representation in memory and fetch full vectors from solid-state storage only when needed. This makes billion-scale datasets feasible on modest hardware, at the cost of higher and less predictable latency. It is a good fit for cold or archival collections that are searched occasionally, and a poor fit for a latency-critical autocomplete path.

The mistake people make most often is reaching for the most aggressive compression first. Start with the mildest setting that fits your memory budget, measure recall against a labeled query set, and only then compress harder. Recall regressions are silent. Nothing errors out; results just get slightly worse.

Measuring Whether Scaling Actually Worked

You cannot tune what you do not measure. Three numbers matter, and they should be tracked together:

  • Recall@k against a ground-truth set built by brute-force search on a sample of queries.

  • p95 and p99 latency for the full query path, including fan-out and merging.

  • Queries per second per dollar, which is the number your finance team will eventually ask about.

A change that improves any one of these in isolation is not a win. Dropping memory by 60 percent while recall falls from 0.95 to 0.80 is usually a bad trade for a search product. Raising throughput by adding replicas without checking recall after a quantization change is worse, because you have scaled a degraded system.

Build the ground-truth set once, keep it versioned, and rerun it after every index parameter change. It is the single highest-leverage habit in this discipline.

Multi-Tenant and Filtered Search: The Underrated Scaling Problem

Two workloads break naive scaling assumptions.

Filtered search combines a vector query with a metadata condition, such as “similar items in this category under this price.” Pre-filtering shrinks the candidate set but can wreck graph traversal, because the graph was built without knowledge of the filter. Post-filtering preserves graph quality but may return too few results when the filter is selective. Vendors handle this differently, and the differences show up only under skewed data.

Multi-tenancy compounds it. If one collection serves many customers, a single large tenant can dominate a shard. The approaches for separating tenant data in an enterprise assistant are worth studying, because the isolation model you choose affects both performance predictability and how you reason about data boundaries.

Cost Tracking Deserves a Seat at the Table

Vector workloads move a lot of data. Replicating a 300-gigabyte index across three regions, then running nightly rebuilds, generates egress and storage charges that surprise teams who budgeted only for compute. A clearer way to track cloud data transfer costs is worth setting up before your first multi-region deployment, not after the first invoice.

A Sensible Scaling Sequence

Most teams do better following a fixed order rather than jumping to distributed architecture.

  • Measure recall and latency on a single node with a realistic dataset.

  • Tune index parameters (graph degree, probe count) before changing hardware.

  • Apply the mildest quantization that fits your memory budget.

  • Add read replicas to handle query throughput.

  • Shard only when a single node genuinely cannot hold the index.

  • Consider disk-based indexes for cold collections.

Each step costs less than the one after it. Skipping ahead to sharding is the most common and most expensive mistake, because it adds operational complexity that you then have to debug while also chasing a recall problem.

Conclusion

Vector database scaling is not a single upgrade you buy. It is a sequence of tradeoffs between memory, latency, recall and cost, and the right answer depends on which of those four your product actually needs. Get the measurement habit in place first, tune the index before you touch the cluster, and treat compression as a dial rather than a switch. The systems that scale gracefully are rarely the ones with the most nodes. They are the ones whose teams know exactly what they gave up, and why.

Frequently Asked Questions

What is vector database scaling?

It is the practice of keeping a vector search system fast and affordable as the number of stored vectors and the query load grow. It combines index tuning, compression, replication and sharding, and it usually involves trading some search accuracy for lower memory use or latency.

When should I shard a vector index instead of adding memory?

Shard when a single node can no longer hold the index in memory even after compression, or when one machine cannot serve your query throughput. If compression and read replicas still leave headroom, sharding adds complexity you do not yet need.

Does quantization always reduce search quality?

It reduces accuracy in almost every case, but the size of the loss varies enormously. Scalar quantization to 8-bit integers typically costs very little recall. Aggressive binary quantization can cost a lot unless you rerank candidates using the original vectors.

Why does filtered vector search perform poorly sometimes?

Because the index was built without knowing about your filters. Pre-filtering can leave the graph traversal with too few valid paths, while post-filtering can return fewer results than requested. Selective filters on skewed data are the hardest case.

How do I measure whether my scaling changes hurt recall?

Build a ground-truth result set by running brute-force exact search on a sample of real queries, then compare your ANN results against it after every parameter change. Track recall alongside p95 latency and cost per query, never in isolation.

Is disk-based vector search a replacement for in-memory indexes?

Not usually. Disk-based approaches make very large collections affordable by keeping compressed data in memory and fetching full vectors from storage, but latency is higher and less predictable. They suit cold or archival collections better than latency-critical paths.

Latest articles

Scroll to Top