Deployed Lab

Module 4 · Data and runtime infrastructure · Chapter 13 · Free

Vector databases in production: indexing, recall and scaling

20 min1 clickable picture1 hands-on lab1 predict, 2 quick quizzes, 5-question final quiz5-min video review
In 30 seconds

The picture: the index is a library map that points you to the right shelf quickly, and sometimes to the wrong one.

What this chapter gives you
The cold open

Copperline is a made up B2B SaaS company. Priya Nair, its staff platform engineer, launched the copilot's vector store on one small node and moved on. All figures here are illustrative.

The fix was not a bigger node. It was sizing math and a recall check.

The plan for this chapter
  1. The job: retrieval for the copilot.
  2. Index families: graph versus clustered.
  3. Recall versus latency, measured.
  4. Memory sizing math, worked.
  5. Filtering, scaling, and freshness.
  6. The picture, and a sizing lab.

Next: what the vector database actually does for the copilot.

Step 1: The job, finding the right pages before the model answers

The copilot should answer from Copperline's help documents, not from model memory. The vector database finds those documents.

Think of a librarian who has read every page and points to the five most relevant in a blink. Where the picture breaks down:

Next: the two index families you will choose between.

Step 2: Index choices, graph versus clustered

Checking a question against every vector is exact but slow at millions of vectors. Indexes trade a little accuracy for a lot of speed. Two families cover most products.

Products here include dedicated vector databases and vector extensions for existing databases, most offering one or both families under their own setting names.

Think of graph search as following signposts between towns, and clustered search as picking the right district, then walking its streets. Where the picture breaks down: signposts are rebuilt as data changes, and district borders are learned from data, so some districts hold far more vectors.

Next: the trade every index makes, and how to put a number on it.

Step 3: Recall versus latency, measured, not vibes

An approximate index returns most of the true nearest neighbours, quickly. Recall says how many: recall at 10 of 0.9 means 9 of the true top 10 appear in the index's top 10.

How to measure recall against brute force:

  1. Take a sample of real questions, say an illustrative 200, from production logs.
  2. Run each against a flat search over the same vectors. That exact top 10 is ground truth.
  3. Run each against the index with your candidate settings, count the overlap, and average it. That average is recall at 10 for those settings, on your data.
  4. Repeat after index changes, data growth, or an embedding model change.

Predict first:

Narrower settings trade recall for latency. The page can be present and well embedded, yet never visited by the search. A brute force sample would have shown the drop the day the setting changed.

Next: the picture, a question flowing through retrieval.

Step 4: The picture, from question to grounded answer

Press Next to walk a question through retrieval.

Retrieval through a vector database A question is embedded, the index searches inside a filter, and nearest chunks ground the answer. Questioncustomer asks Embedquestion vector Index searchfilters applied Vector storechunks and vectors Copilot answergrounded reply
  1. A customer asks about refunds, with tenant and product filters attached.
  2. The ingest embedding model turns the question into a vector. Mismatched models mean mismatched vectors.
  3. The index walks toward the question vector, inside the filter, and ranks the nearest chunks.
  4. Top chunks and their text are read out. Recall is won or lost here.
  5. The chunks go into the prompt and the copilot answers from them.

Next: the worked example, sizing the index on paper.

Step 5: Worked example, memory sizing math

The formula is simple: memory equals count times dimensions times bytes per number. All figures are illustrative.

1. The raw vectors. Copperline has 2,000,000 chunks, 768 dimensions, 4 byte floats. 2,000,000 x 768 x 4 = 6,144,000,000 bytes, about 6.1 GB.

2. Index overhead. A graph index adds links per vector. At an illustrative 30 percent, add about 1.8 GB. Total: about 7.9 GB. Clustered indexes usually add less.

3. The rest of the record. IDs, filter metadata, and stored text: at an illustrative 0.5 KB per chunk, another 1 GB. Total: about 8.9 GB, before the process itself.

4. The decision. A 16 GB node fits with headroom. The cold open node, at an illustrative 8 GB, never stood a chance. Half precision (2 bytes) would cut step 1 to about 3.1 GB, at a recall cost to verify via Step 3.

5. The lesson. Count, dimensions and bytes per float set the floor. Index choice moves the overhead. Do this math before every big import.

Next: filters, scaling shapes, and keeping the index fresh.

Step 6: Metadata filtering, and what it costs

Vectors alone are not enough. The copilot must only retrieve the customer's own tenant data, the right product, and current versions. Those checks are metadata filters.

Next: scaling the store, and what breaks first.

Step 7: Scaling shapes, and what breaks first

Think of replicas as photocopies of one map in many hands, and shards as splitting the map into volumes. Where the picture breaks down: photocopies go stale on every change, and each search must check several volumes.

Next: freshness, how changed documents reach the index.

Step 8: Freshness, from edited page to searchable vector

Next: the lab, where you size and set an index for a stated workload.

Step 9: Hands-on lab, size it and pick the settings

Why this exercise: index choices are sizing and trade decisions, made on paper against a stated workload.

The workload (illustrative): 5,000,000 chunks at 1,024 dimensions, float32, read heavy traffic, a recall at 10 target of 0.95, and a strict tenant filter on every query.

Lab: Priya is sizing Copperline's copilot vector store and, this time, measuring recall before launch instead of guessing it. This lab runs in your browser and needs JavaScript enabled.

What to notice

Next: a field note and the mix-ups.

Field note, November 2026

In production practice, vector stores fail quietly: recall drifts as data grows, filters change search behaviour, and stale documents keep answering. Teams that run them well treat recall sampling and freshness lag as ordinary metrics, checked on a schedule. Defaults vary by product, so measure on your own data.

Mix-ups to avoid

Chapter quiz

Five questions, 70% to pass.

Review this chapter in 5 minutes

Watch the whole chapter recapped: index families and recall, memory sizing math, replicas versus shards, and freshness lag.

Decision rule: size memory on paper, set a recall target, prove it against brute force with filters on, then scale reads with replicas and data with shards.

Review

Glossary

Vector
A list of numbers capturing a chunk's meaning.
Graph index
An index linking vectors to near neighbours, searched by walking links: HNSW style.
Clustered index
An index grouping vectors into clusters, searching the nearest few only: IVF style.
Recall at 10
Share of the true top 10 the index returns in its top 10: 9 of 10 found is 0.9.
Brute force search
Exact search over every vector: ground truth in a recall test.
Metadata filter
A condition applied with the search, such as only this customer's documents.
Replica
A full copy of the index serving reads: three copies spreading peak load.
Shard
One slice of the data on one node: tenants A to M on shard one.

Next: "Embedding pipelines: ingestion, reindexing and versioning".