1 min readMay 24, 2025
pgvector: HNSW vs IVFFlat Index — A Practical Comparison
Benchmarked both index types on 1M vectors. HNSW wins on query speed but IVFFlat is better for high-write workloads.
Observation
HNSW gives better query speed in most read-heavy retrieval systems, but write behavior and rebuild expectations matter more than benchmark charts suggest.
Practical note
Choose the index that matches your update pattern, not the one with the prettiest single-query number.