Comparison
HNSWvsIVFFlat
HNSW
you built the index, watched memory use climb and the build take a while, and got fast accurate search out of it.
Hierarchical navigable small world: the dominant ANN index, a layered graph navigated greedily from coarse to fine. Fast and accurate, at the cost of memory and slower index builds. The default in most vector stores, including pgvector.
Full entry →IVFFlat
you pick the cheaper, smaller index because the machine is memory-bound, and accept lower recall at the same speed.
An older ANN approach: cluster vectors into lists, search only the closest lists. Cheaper to build and smaller than HNSW, usually lower recall at the same speed. pgvector offers both; start with HNSW unless memory forces otherwise.
Full entry →