1:1 mentoring with Big Tech AI engineers
RAG & MCP

Vector Indexes & Stores

How a vector index stores and searches embeddings: the index as a rebuildable copy, how HNSW finds neighbours and what ef_search changes, RAM arithmetic, and choosing a store from constraints.

Last updated

Core12 min readFirst readEmbeddingsChunking Strategies

After this section you can

  • Explain how an HNSW query descends the layers, and what ef_search changes
  • Estimate the RAM an index needs from vector count, dimensions, precision and M, and measure the real size
  • Choose a store class from workload constraints and name the trigger that would change the choice
05

Vector Indexes & Stores: HNSW, Recall and RAM

How an index finds neighbours fast, what recall it costs, what RAM it needs, how to pick a store.

Key idea

A vector index is a rebuildable copy of your chunks: one vector each, plus a graph (HNSW, hierarchical navigable small world) that lets a query skip almost all of them. It is approximate: its recall is the share of true nearest neighbours (from an exact scan) it returns, set by ef_search and your data, and measured. It is searched from RAM, so bytes per vector times vectors sets its size.

A query drops through sparse layers, then widens to ef candidates on layer 0
Layer 2 · 3 pointsLayer 1 · 8 pointsLayer 0 · 24 pointsentryquery1 Enter2 Hop3 Drop4 Widen5 Stopef = 4 list, closest first1closest234worst keptmissed at ef 4found at ef 8ef 4: 2 of 3 found, 12 distancesef 8: 3 of 3 found, 17 distances

Toy graph, not to scale. ef 4 finds 2 of 3 true neighbours in 12 distances, ef 8 all 3 in 17. Swipe to pan.

Related

More in RAG & MCP

Get full access to all 149 sections with code examples, diagrams, and interactive animations.

Unlock Premium