IT lexicon › Database › IVFFlat

IVFFlat Inverted File, Flat

Database På svenska → Updated: 2026-07-30

Inverted File with Flat compression — a cluster-based algorithm for approximate vector search. It divides the vector space into clusters (via centroids); a search only looks in the nearest clusters instead of the whole dataset. Less memory than HNSW but requires "training" the index.

Mechanic: first k-means clustering → each vector belongs to its nearest centroid. At search time the probes nearest clusters are chosen and only their vectors are compared. More probes = better recall but slower. Win: significantly less memory than HNSW, fast build. Trade-off: it requires representative training data (the centroids) → bad if the data changes a lot or the index is built on an empty dataset; often lower recall than HNSW at the same speed. Use case: large datasets where memory is limited. In pgvector you choose between IVFFlat (memory-frugal) and HNSW (faster/more accurate, more memory). A classic trade-off in vector databases: graph vs cluster.

← Back to the lexicon