Two indexes ship with pgvector
- HNSW (Hierarchical Navigable Small World) — graph-based ANN. Higher recall, slower build, supports incremental inserts. The 2026 default.
- IVFFlat (Inverted File with Flat compression) — partition-based. Faster to build, lower recall, requires periodic rebuild as data grows.
Choosing parameters
For HNSW the two knobs are m (graph degree, default 16) and ef_construction (build effort, default 64). For queries, SET hnsw.ef_search = 40 trades recall for latency at runtime. For IVFFlat, lists at create time and ivfflat.probes at query time play the same role.
What 'recall' actually means here
ANN indexes are approximate. Recall is the fraction of true top-k results the index actually returns. HNSW typically delivers 0.95–0.99 with default settings; IVFFlat with low probes can drop to 0.7. Always measure recall against an exact scan on a held-out query set before trusting numbers.