Vector Database HNSW Index RAM, Quantization & Disk Sizing Calculator
Interactive Vector Database HNSW Index RAM & Disk Calculator
?
Number of stored vectors, in millions (0.1 to 500, step 0.5). Use the points or rows count of the collection, not the number of source documents.?
Vector length of the embedding model: 384 for BGE-Small, 768 for BGE-Base, 1536 for text-embedding-3-small, 3072 for text-embedding-3-large. Read it from the model card.?
Bytes stored per dimension: 4 for FP32, 2 for FP16, 1 for scalar quantization (SQ8), 0.125 for binary quantization (BQ). Qdrant documents SQ8 at 4x and BQ at up to 32x compression. SQ8 and BQ keep the original FP32 vectors beside the quantized ones, so the disk estimate adds them (the RAM figure does not).?
HNSW link parameter M, the number of graph neighbours per node. Choose one of 8, 16, 32 or 64. Higher M raises recall and the graph's RAM in proportion. Set it in the index configuration of your database.?
Average payload bytes stored on disk per vector, not in the RAM figure (0 to 4096, step 32). Measure the length of the JSON you store with a sample of real points.?
RAM of the node that will host the index, in GiB. Read it from the instance type or from free -g. The result shows the share of this RAM that the total uses, and turns amber above 85 % and red above 100 %. Choices run from 64 to 1,024 GiB; default 128.Use the Vector Database HNSW Index RAM & Disk Calculator to evaluate RAM_HNSW = 1.5 · N_vec · (D_dim · B_quant + 2 · M · 4 · 1.15) for Qdrant / Milvus / pgvector semantic search clusters, enterprise RAG knowledge bases. With the defaults (Total Stored Vectors = 10 Millions, Embedding Vector Dimensions = 1536 dim, Vector Element Precision = FP32 Full Precision) it returns Raw vector & HNSW graph footprint: Vectors = 57.22 GiB · HNSW Graph = 1.37 GiB.
Governing equationRAM_HNSW = 1.5 · N_vec · (D_dim · B_quant + 2 · M · 4 · 1.15) (Engineering estimate: HNSW memory model; the graph-link and overhead constants are model assumptions)
Why an HNSW Index Needs More RAM Than the Raw Vectors
Approximate nearest neighbor search with HNSW, the hierarchical navigable small world graph of Malkov and Yashunin (arxiv.org/abs/1603.09320), answers a query by walking a multi-layer proximity graph instead of comparing against every vector. Qdrant, Milvus, Weaviate and pgvector keep the vectors and the graph in memory for that walk, so the RAM bill has two parts: the vectors and the graph links. The payload held beside them is stored on disk and is not in the RAM figure.
Raw vector bytes equal vectors times dimensions times bytes per dimension. IEEE 754 single precision uses 32 bits, so FP32 is 4 bytes per dimension (en.wikipedia.org/wiki/Single-precision_floating-point_format). Qdrant documents scalar quantization (int8, 1 byte) as 4x compression and binary quantization as up to 32x (qdrant.tech/documentation/guides/quantization/). For the default 10 million vectors of 1,536 dimensions in FP32, the vectors take 10,000,000 x 1,536 x 4 bytes = 57.22 GiB.
| Quantization Mode | Bytes / Dim | Raw Vector Size | HNSW Graph Size | Total RAM Needed | NVMe Disk Needed |
|---|---|---|---|---|---|
| FP32 (32-bit Float) | 4.0 B | 57.22 GiB | 1.37 GiB | 87.89 GiB | 89.68 GiB |
| FP16 (16-bit Half) | 2.0 B | 28.61 GiB | 1.37 GiB | 44.97 GiB | 46.76 GiB |
| SQ8 (8-bit Scalar) | 1.0 B | 14.31 GiB | 1.37 GiB | 23.51 GiB | 111.13 GiB |
| BQ (1-bit Binary) | 0.125 B | 1.79 GiB | 1.37 GiB | 4.74 GiB | 92.36 GiB |
How to Evaluate Graph Links, Payload and the Planning Factor?
The graph adds links per vector. The calculator uses 2 x M x 4 bytes x 1.15 per vector. At M = 16 that is 147.2 bytes per vector, or 1.37 GiB for 10 million vectors. The 4-byte link size, the 2M links on the bottom layer and the 1.15 overhead are model assumptions. The cited pages confirm the trade-off, that more graph connections improve recall but need more memory (en.wikipedia.org/wiki/Hierarchical_navigable_small_world), but not these constants. The payload term (128 bytes per vector here, 1.19 GiB) is stored on disk and does not enter the RAM total.
The RAM total is 1.5 times the sum of vectors and graph. The 1.5 factor is a declared planning margin for segment merges and index builds. No primary source confirms the 1.5 planning margin; it is a model assumption. The default result is 87.89 GiB of RAM and 89.68 GiB of disk, where disk equals (vectors + graph + payload) times 1.5. The calculator reports binary gibibytes (1 GiB = 1,024^3 bytes). The disk figure is an estimate built from vectors, graph, payload and a 1.5 planning factor; write-ahead logs and snapshots are not modeled separately. For SQ8 and BQ the disk estimate also adds the original FP32 vectors, because Qdrant stores the quantized vectors alongside the originals (qdrant.tech/documentation/guides/quantization/): at 10 million vectors of 1,536 dimensions in SQ8 it is (57.22 + 14.31 + 1.37 + 1.19) x 1.5 = 111.13 GiB. The Node RAM input (64 to 1,024 GiB, default 128) is the reference for the status pill: the 50-million preset needs 878.87 GiB, which is 85.8 % of a 1,024 GiB node.
| Vector Count | Dimensions | FP32 Total RAM | SQ8 Total RAM | RAM Saved with SQ8 (FP32 − SQ8) |
|---|---|---|---|---|
| 1M Vectors | 768 dim | 4.5 GiB | 1.3 GiB | 3.2 GiB |
| 5M Vectors | 768 dim | 22.5 GiB | 6.4 GiB | 16.1 GiB |
| 5M Vectors | 1536 dim | 43.9 GiB | 11.8 GiB | 32.2 GiB |
| 10M Vectors | 1536 dim | 87.9 GiB | 23.5 GiB | 64.4 GiB |
| 25M Vectors | 1536 dim | 219.7 GiB | 58.8 GiB | 160.9 GiB |
| 50M Vectors | 3072 dim | 868.6 GiB | 224.9 GiB | 643.7 GiB |
Worked Examples: Two Presets Calculated with RAM_HNSW = 1.5 · N_vec · (D_dim · B_quant + 2 · M · 4 · 1.15)
Worked Example 1 (25M vectors, SQ8 quantized, 256 B payload): This preset sets Total Stored Vectors = 25 Millions, Embedding Vector Dimensions = 1536 dim, Vector Element Precision = SQ8 Scalar Quantization, HNSW Bi-Directional Links = M = 16, JSON Payload per Vector, Kept on Disk = 256 Bytes, Node RAM = 128 GiB node. Evaluating RAM_HNSW = 1.5 · N_vec · (D_dim · B_quant + 2 · M · 4 · 1.15) gives: vector data = 35.76 GiB, HNSW graph = 3.43 GiB, payload on disk = 5.96 GiB, total RAM = 58.79 GiB, total disk = 282.3 GiB, node RAM = 128.0 GiB, share of the node RAM = 45.9 %. Related in the Cloud, API, LLM & Automation Hub: Redis & Valkey Memory Sizing & Overhead Calculator (same RAM-sizing method for an in-memory store) and LLM VRAM Calculator: Model Weights & KV Cache Sizing (if you also host the embedding model, its GPU memory is sized there).
Worked Example 2 (50M text-embedding-3-large vectors, FP32, M = 32): This preset sets Total Stored Vectors = 50 Millions, Embedding Vector Dimensions = 3072 dim, Vector Element Precision = FP32 Full Precision, HNSW Bi-Directional Links = M = 32, JSON Payload per Vector, Kept on Disk = 512 Bytes, Node RAM = 1,024 GiB node. The calculator returns: vector data = 572.2 GiB, HNSW graph = 13.71 GiB, payload on disk = 23.84 GiB, total RAM = 878.87 GiB, total disk = 914.63 GiB, node RAM = 1024.0 GiB, share of the node RAM = 85.8 %. You can compare these limits with other calculators in the Engineering Studio.
How to Evaluate Quantization and Recall Before You Commit to a Size?
Quantization is the largest lever. At the 25-million-vector preset with 1,536 dimensions, SQ8 reduces the vectors to 35.76 GiB, and the total RAM to 58.79 GiB. The 256-byte payload adds 5.96 GiB to the disk figure, not to RAM, and the original FP32 vectors (143.05 GiB before the 1.5 factor) bring that preset's disk estimate to 282.30 GiB; the RAM figure does not change because the originals can be kept on disk. The comparison table shows FP32 against SQ8 across collection sizes. Recall loss from quantization is not modeled, so test it on your own embeddings before relying on the lower figure.
Sources
- Qdrant · QuantizationScalar quantization (int8) gives 4x compression versus float32; binary quantization gives up to 32x. Basis of the SQ8 (1 byte) and BQ (0.125 byte) options per dimension. Quantized vectors are stored alongside the original vectors in the collection and rescoring uses the originals, so the disk estimate adds the FP32 originals for SQ8 and BQ.
- Wikipedia · Single-precision floating-point format General definitionIEEE 754 single precision occupies 32 bits (4 bytes): 1 sign, 8 exponent and 23 significand bits. Basis of the FP32 option at 4 bytes per dimension.
- Malkov & Yashunin · Efficient and robust approximate nearest neighbor search using HNSW (arXiv:1603.09320)Defines the hierarchical navigable small world graph used for approximate nearest neighbor search. The abstract page does not state the link parameter M or the 2M bottom-layer maximum; the 2M term and the 4-byte link size are model assumptions.
- Wikipedia · Hierarchical navigable small world General definitionStates that HNSW is a hierarchical proximity graph and that more graph connections improve recall but require more memory. Basis of the trade-off that makes M a memory term.
Method and test suite: Calculation Methodology.
Frequently Asked Questions: Vector Database HNSW Index RAM & Disk Calculator
How much of the RAM figure is the 1.5x margin?
About a third. The vectors and graph sum to 58.59 GiB, and the 1.5 factor brings that to 87.89 GiB, so 29.3 GiB of the total is margin. Measure the resident memory of a representative collection to replace the factor with a real value.
Does quantization change the graph size?
No. The graph term depends on the number of vectors and on M, not on bytes per dimension. At 1,536 dimensions a binary vector takes 192 bytes, while the default graph takes 147.2 bytes per vector, so the graph is almost as large as the vectors themselves.
What does raising M cost?
The graph term is proportional to M, so M = 32 doubles the graph share compared with M = 16. The 50-million preset at M = 32 needs 878.87 GiB of RAM at 3,072 dimensions in FP32, which is why M and quantization should be decided together.
Is the payload the same as the text chunk?
No. The payload term is the metadata stored with each vector. The calculator counts it on disk and leaves it out of the RAM figure. Measure the JSON length of a sample of points. Large text chunks add to the disk figure. If you configure your database to keep payload in RAM, add the payload figure to the RAM total yourself.