Expand description
Vector index management for pgvector.
pgvector supports two approximate nearest-neighbor (ANN) index types:
| Index | Algorithm | Best For | Tradeoff |
|---|---|---|---|
| IVFFlat | Inverted file with flat quantization | Large datasets, tunable recall | Requires training data |
| HNSW | Hierarchical navigable small world | Most workloads, no training needed | Higher memory usage |
§Choosing an Index
- HNSW is recommended for most use cases — better recall/speed tradeoff, no training step, and supports concurrent inserts.
- IVFFlat is useful when memory is constrained or when you have very large datasets and can tolerate a training step.
Modules§
- extension
- SQL helpers for pgvector extension management.
Structs§
- Binary
Vector Index - A binary vector index definition.
- Binary
Vector Index Builder - Builder for
BinaryVectorIndex. - Hnsw
Config - Configuration for HNSW indexes.
- IvfFlat
Config - Configuration for IVFFlat indexes.
- Vector
Index - A vector index definition.
- Vector
Index Builder - Builder for
VectorIndex.
Enums§
- Index
Type - The type of ANN index to create.