Benchmarks/Vector search

Exact vector search vs HNSW, 10k to 1M vectors

When do you actually need a vector database?

3.5 msexact search, 100k × 384-dim, 2 vCPUs

Short answer: Exact numpy search over 100k 384-dim vectors took 3.5 ms on 2 vCPUs, and 62 ms at 1M. HNSW answered in under a millisecond, but its recall depended heavily on the data: 0.995 at ef=64 on clustered vectors, 0.206 on uniform random ones.

Tested 27 September 2026 · Read the full write-up

Exact search latency (numpy) by vector count↓ lower is better
050100150200ms per query10,000100,000500,0001,000,000vectors384-dim, 10,000: 0.35384-dim, 100,000: 3.5384-dim, 500,000: 31384-dim, 1,000,000: 62768-dim, 100,000: 10.6768-dim, 500,000: 57768-dim, 1,000,000: 1141536-dim, 10,000: 1.21536-dim, 100,000: 201536-dim, 500,000: 107
  • 384-dim
  • 768-dim
  • 1536-dim

What the numbers say

  • Below about 100k chunks, a numpy matrix multiply is fast enough for almost any RAG app.
  • Latency grows roughly linearly with vector count and with dimension.
  • Measure HNSW recall on your own data before trusting it.

Exact search latency

38410,00015 MB0.35 ms0.78 ms
384100,000154 MB3.5 ms8.3 ms
384500,000768 MB31 ms66 ms
3841,000,0001.5 GB62 ms122 ms
768100,000307 MB10.6 ms22.6 ms
768500,0001.5 GB57 ms120 ms
7681,000,0003.1 GB114 ms240 ms
153610,00061 MB1.2 ms3.1 ms
1536100,000614 MB20 ms51 ms
1536500,0003.1 GB107 ms248 ms

HNSW: latency and recall at ef = 32 / 64 / 128

clustered384100k23 s0.10 ms, recall 0.9540.17 ms, 0.9950.34 ms, 1.000
clustered768100k48 s0.22 ms, 0.8780.36 ms, 0.9850.68 ms, 1.000
uniform384100k37 s0.16 ms, 0.1290.31 ms, 0.2060.55 ms, 0.281
uniform768100k69 s0.34 ms, 0.0580.63 ms, 0.1051.07 ms, 0.172
uniform384500k279 s0.19 ms, 0.0340.35 ms, 0.0570.67 ms, 0.099

Rule of thumb

under 100k chunksnumpy (or pgvector with no index). Store vectors in a .npy file or Postgres.
100k to 1M chunksexact search is still fine at low QPS. Add HNSW when p95 latency or QPS demands it, and measure recall.
over 1M chunks, or many tenantsa proper ANN index (pgvector HNSW, Qdrant, Milvus, OpenSearch), plus filtering and sharding.

Setup

2 vCPU Intel Xeon @ 2.1 GHz, 7 GB RAM, Python 3.11, numpy 2.4.4, faiss-cpu 1.15.1, hnswlib. Synthetic normalized float32 vectors. Median of 50 (exact) or 200 (HNSW) single queries.

Reproduce it

The complete script is at the end of the write-up.

More benchmarks

All benchmarks →