Lesson 22.5 · 5 of 8 · 4 min read · Reviewed 24 Nov 2026
Choosing a vector store and sizing it
By the end, you can
- Choose a vector store.
- Estimate its size and cost.
The options
| Option | Good for | Watch out for |
|---|---|---|
| In-process library | Prototypes, small static sets, edge devices | No server features; you manage persistence |
| Vector extension in your database | Up to millions of vectors; joins with your data | Tuning at very large scale |
| Dedicated vector database | Large scale, heavy filtering, high query rates | Another system to run |
| Managed service | Teams that don’t want to operate it | Cost, data residency (70.4) |
Sizing
raw size = chunks x dimensions x bytes per value
1,000,000 chunks x 1,024 dims x 4 bytes (float32) = about 4 GB
+ index overhead (HNSW links, often tens of percent)
+ the chunk text and metadata
Ways to shrink: fewer dimensions (if your embedding modelEmbedding model: A model trained to turn text (or images) into embeddings for search and comparison, rather than to generate text. supports it), float16 or int8 storage, or product quantizationQuantization: Storing model weights with fewer bits, such as 4 or 8 instead of 16, to cut memory and speed up inference. (22.3).
Questions to ask
- How many chunksChunking: Splitting documents into smaller passages before embedding and indexing them. now, and in a year?
- What filters do queries need (tenant, date, type)?
- Is hybrid keyword search needed?
- Queries per second and latencyLatency: The time from sending a request until you get the response, or until the first token arrives when streaming. target?
- Where must data live?
- Who will operate it?
Don’t over-build
Many RAGRetrieval-augmented generation (RAG): Retrieving relevant documents at request time and adding them to the prompt so the answer is grounded in them. systems work well with a database extension and a few hundred thousand chunks. Move to a dedicated store when measurements, not guesses, say you need to.
Key points
- Options range from a library in your app, to a vector extension in your existing database, to a managed vector service.
- Estimate size: number of chunks x dimensions x bytes per number, plus index overhead.
- Choose by scale, filtering needs, operations effort and what your team already runs.
Size a vector store with a calculator
Estimate the memory a vector index needs, and see how storage precision and overhead change it.
You will have: A sizing function and a table for one corpus at float32, float16 and int8.
Steps
- Write raw_gb(chunks, dims, bytes_per_value).
- Add index overhead as a percentage on top.
- Print a table for 2 million chunks at 768 dimensions with 25% overhead.
- Try your own numbers: chunks now and in a year.
Done when
- float32 prints about 7.7 GB with overhead.
- int8 is a quarter of float32.
Open in the Playground No API key needed.
Starter code (Python)
def raw_gb(chunks, dims, bytes_per_value):
# TODO: chunks x dims x bytes, in GB (divide by 1e9)
return 0.0
def with_overhead(gb, overhead_pct):
# TODO
return gb
for name, b in [("float32", 4), ("float16", 2), ("int8", 1)]:
gb = with_overhead(raw_gb(2_000_000, 768, b), 25)
print(f"{name}: {gb:.1f} GB")
Show a solution
def raw_gb(chunks, dims, bytes_per_value):
return chunks * dims * bytes_per_value / 1e9
def with_overhead(gb, overhead_pct):
return gb * (1 + overhead_pct / 100)
sizes = {}
print(f"{'storage':9}{'raw GB':>8}{'with index':>12}")
for name, b in [("float32", 4), ("float16", 2), ("int8", 1)]:
raw = raw_gb(2_000_000, 768, b)
sizes[name] = with_overhead(raw, 25)
print(f"{name:9}{raw:>8.2f}{sizes[name]:>12.2f}")
print(f"float32 total: {sizes['float32']:.1f} GB")
print(f"int8 is {sizes['float32'] / sizes['int8']:.0f}x smaller than float32")