![[assets/str_idx_ivfflat.png|256]]
- **Description**: "Inverted File with Flat Compression". It uses **k-means clustering** to partition the vector space into several Voronoi cells (clusters).
- **Data Structure**:
- **Centroids**: The "center" points of each cluster, stored in an internal B-tree for fast identification.
- **Inverted Lists**: Each centroid points to a flat list of TIDs belonging to that cluster.
- **Training**: Unlike other indexes, IVFFlat requires a "training" phase (`lists`) where it analyzes existing data to determine the optimal centroid positions.
- **Query Logic (`probes`)**: At query time, the engine identifies the $N$ nearest centroids (`probes`) and only scans the inverted lists associated with them.
- **Extension**: Requires `pgvector`.
- **Supported Operators**: `<->`, `<#>`, `<=>`, `<+>`.
- **Metaphor**: A city map divided into distinct neighborhoods. Instead of searching every house, you identify the 2 or 3 neighborhoods most likely to contain your target and only search there. If you increase your `probes`, you're just visiting more neighborhoods to be safe.