pgvector/pgvector
Open-source vector similarity search for Postgres
What it solves
pgvector is an open-source extension for PostgreSQL that allows you to store and search vector embeddings directly within your database. This eliminates the need for a separate specialized vector database by allowing you to keep your embeddings alongside your relational data, while maintaining ACID compliance and supporting standard SQL queries.
How it works
It introduces a new vector data type and specialized distance operators to perform similarity searches. It supports several vector types including single-precision, half-precision (halfvec), binary (bit), and sparse vectors (sparsevec).
To speed up searches, it provides two types of approximate nearest neighbor (ANN) indexes:
- HNSW (Hierarchical Navigable Small World): A multilayer graph index that offers high query performance and better speed-recall tradeoffs, though it requires more memory and slower build times.
- IVFFlat (Inverted File Flat): An index that divides vectors into lists (clusters) and searches only the closest lists, offering faster build times and using less memory than HNSW.
Who it’s for
Developers and data engineers who already use PostgreSQL and want to integrate vector similarity search for AI applications (like RAG or recommendation systems) without adding new infrastructure complexity.
Highlights
- Postgres Integration: Leverages full Postgres features like JOINs, ACID compliance, and point-in-time recovery.
- Diverse Vector Support: Handles single-precision, half-precision, binary, and sparse vectors.
- Multiple Distance Metrics: Supports L2 distance, inner product, cosine distance, L1 distance, Hamming distance, and Jaccard distance.
- Hybrid Search: Can be combined with Postgres full-text search for hybrid retrieval.
- Advanced Indexing: Includes iterative index scans to improve recall when filtering with
WHEREclauses.
Related
- Project
- Project
- Project
- Project
- Project