ANSWERS · VECTOR SEARCH SIZING

Vector index RAM calculator: how much memory does an HNSW index need?

AUTHOR · XERJ documentation team · REVIEWED BY · XERJ engineering team · PUBLISHED · 2026-11-22 · UPDATED · 2026-11-22
SHORT ANSWER · UPDATED 2026-11-22

How much RAM does a vector index need? Multiply vectors × dimensions × bytes per dimension, add the HNSW graph (points × m × 2 × 4 bytes × 1.2 in Qdrant's guide), then add 20% headroom. One million 768-dimension float32 vectors with m = 16 need about 3.6 GiB.

Key number: 1,000,000 × 768 float32 vectors take 2.86 GiB, plus 0.14 GiB of HNSW graph at m = 16: plan for about 3.6 GiB. (as of 2026-11-22 · formulas: Qdrant capacity planning)

Last checked: 2026-11-22. Formulas from Qdrant's capacity-planning guide, pgvector's README and hnswlib's ALGO_PARAMS. Model dimensions from each model card.

TL;DR Vector memory is plain arithmetic. Pick the number of vectors, their dimensions and the stored type, add the graph, and leave headroom. Smaller types such as int8 and binary cut the vector part by 4x and 32x.

Try it: size your vector index

Vector index RAM calculator

Your index

Presets

Vectors
HNSW graph
Plan for (with 20% headroom)

Runs in your browser and sends nothing. Formulas from Qdrant's capacity-planning guide: vectors = points × replicas × dimensions × bytes per dimension; HNSW = points × replicas × m × 2 × 4 bytes × 1.2; then 20% headroom. Payloads and the ID tracker are extra. 1 GiB = 1,073,741,824 bytes. Checked 2026-11-22.
PASTE THIS TO YOUR AI AGENT. IT DOES THE REST Act as a coding agent. Read https://xerj.org/answers/vector-index-ram-calculator. Count the vectors and dimensions in our embedding setup, size the index with the formulas on that page, and tell me how much RAM to plan for with float32, int8 and binary vectors.

The formula

Worked examples: 1 million vectors, 768 dimensions, m = 16

Vector typeVectorsHNSW graphPlan for
float322.86 GiB0.14 GiB3.60 GiB
float161.43 GiB0.14 GiB1.89 GiB
int80.72 GiB0.14 GiB1.03 GiB
4-bit0.36 GiB0.14 GiB0.60 GiB
binary0.09 GiB0.14 GiB0.28 GiB

Qdrant's own example, 1 million points at 768 dimensions with 2 replicas, gives 5.72 GiB of vectors and 0.29 GiB of graph. The calculator's "Qdrant docs example" preset reproduces both.

Common embedding sizes

ModelDimensionsSource
all-MiniLM-L6-v2384model card
BGE-M31024model card
text-embedding-3-small1536 by defaultOpenAI embeddings guide
text-embedding-3-large3072 by defaultOpenAI embeddings guide

pgvector, Qdrant and other engines

The vector part is the same in every engine that stores raw vectors. pgvector stores vector as 4-byte floats, halfvec as 2-byte floats and bit as bits, and its HNSW index takes up to 2,000, 4,000 and 64,000 dimensions for those types. Qdrant adds quantized copies and memory tiers, so its guide shows how to keep only the quantized copy in RAM. hnswlib puts its graph at roughly m × 8 to 10 bytes per element.

XERJ: a new way for AI to search for data

XERJ is single-node. Its search is lexical by default (BM25), and neural embeddings are opt-in. Many agent questions over code and docs are answered from the keyword index alone, so you can start small and add vectors where they help. See BM25 and vector search side by side and local embeddings without an API.

How this page was checked

On 2026-11-22 we read Qdrant's capacity-planning guide, the pgvector README, hnswlib's ALGO_PARAMS and each model card. The worked examples are computed with the formulas above; no index was built for this page.

Read next

FAQ

How much RAM do 1 million 768-dimension vectors need?

About 2.86 GiB for the float32 vectors and 0.14 GiB for an HNSW graph with m = 16, so plan for about 3.6 GiB with 20% headroom. Payloads and IDs are extra.

What is the formula for vector memory?

Vectors take points × dimensions × bytes per dimension: 4 bytes for float32, 2 for float16, 1 for int8 and 1 bit for binary. Qdrant sizes the HNSW graph as points × m × 2 × 4 bytes × 1.2, and its quick rule of thumb is points × dimensions × 4 bytes × 1.5.

How much does int8 or binary quantization save?

int8 stores 1 byte per dimension instead of 4, so the vectors take a quarter of the float32 size. Binary stores 1 bit per dimension, 32 times less. The HNSW graph stays the same size, and recall should be checked against unquantized results.

Does pgvector use the same formula?

The vector part is the same arithmetic: pgvector stores vector as 4-byte floats, halfvec as 2-byte floats and bit as bits. HNSW indexes in pgvector support up to 2,000 dimensions for vector, 4,000 for halfvec and 64,000 for bit.

What does HNSW m change?

m is the number of links per node. hnswlib notes that memory for the graph is roughly m × 8 to 10 bytes per element, so doubling m roughly doubles the graph size.

Evidence

Related