Both index types are approximate nearest neighbor (ANN) structures. Neither guarantees exact results, and recall is measured as the overlap between the retrieved top k and the true top k, divided by k, with production targets typically at 0.95 or higher the BigData Boutique comparison.
IVFFlat runs k-means over the rows present at build time to define a number of lists, then assigns every vector to its nearest centroid. A query compares itself to all centroids, picks the closest few (controlled by ivfflat.probes), and scans only those lists Jonathan Katz on pgvector indexes. That is why IVFFlat builds fast and is cheap on memory: it stores vectors flat, with no graph.
HNSW builds a hierarchy of graphs where each layer is a sparser subset of the layer below, and search descends from the top layer through progressively denser layers to the bottom one the Crunchy Data walkthrough. The same post notes the trade: HNSW is more performant than list-based indexes, takes longer to build, and needs more memory.
The consequence that matters after growth is structural. IVFFlat's cell boundaries are frozen at CREATE INDEX. Inserts land in whichever existing cell has the nearest centroid and cannot create new clusters, so as the distribution drifts, recall degrades and the standard remedy is a scheduled full rebuild the BigData Boutique comparison. HNSW is designed for adding data iteratively and does not require indexing an existing dataset to reach good recall, which is why pgvector's HNSW supports insert, update and delete Jonathan Katz on pgvector indexes.



