pgvector
Open-source Postgres extension for vector similarity search with HNSW and IVFFlat indexes, joins and ACID guarantees
Overview
pgvector is a Postgres extension that adds a vector column type and similarity search to the database many teams already run. You store embeddings next to your relational data, query nearest neighbors with plain SQL, and join, filter and transact on them like any other column. It supports exact search and two approximate indexes (HNSW and IVFFlat), several vector types (full precision, half precision, binary and sparse) and distance functions including L2, cosine, inner product, L1, Hamming and Jaccard.
Created by Andrew Kane, pgvector is the default way to do vector search in Postgres and ships on nearly every managed Postgres service, including Supabase, Neon, AWS RDS and Aurora, Google Cloud SQL and Azure. It inherits everything Postgres offers: ACID transactions, point-in-time recovery, replication and mature tooling.
The Verdict
Who Should Use pgvector?
Best For
- Teams already running Postgres
- RAG over data that lives in relational tables
- Queries that join vectors with business data and permissions
- Up to tens of millions of vectors on one well-sized instance
Not Ideal For
- Billions of vectors (needs sharding or a dedicated system)
- Teams with no Postgres tuning experience
- Very high-dimensional embeddings in HNSW without reduction
What's Great
- No new infrastructure if you already use Postgres
- Full SQL: joins, filters, transactions and row-level security
- Available on almost every managed Postgres provider
- HNSW indexes give good recall and speed
- Free and open source
Watch Out For
- Performance needs care beyond roughly 10M vectors
- HNSW index builds are memory-hungry and slow on big tables
- Filtered queries can lose recall without tuning
- Index dimension limits (2,000 for full-precision HNSW)
Pricing
View all features & details
Key Features
- vector, halfvec, bit and sparsevec types
- HNSW and IVFFlat indexes
- Exact and approximate nearest neighbor search
- L2, cosine, inner product, L1, Hamming and Jaccard distances
- Iterative index scans for filtered queries
Where It Runs
- Self-hosted Postgres 13+
- Supabase, Neon, AWS RDS and Aurora
- Google Cloud SQL and AlloyDB, Azure
- LangChain and LlamaIndex vector stores
How It Compares
| Feature | pgvector | Supabase Vector | Pinecone | Milvus |
|---|---|---|---|---|
| Open source | Yes | Yes (pgvector) | No | Yes |
| SQL joins with app data | Yes | Yes | No | No |
| Managed option | Any Postgres host | Yes | Fully managed | Zilliz Cloud |
| Practical scale | Tens of millions | Tens of millions | Billions | Billions |
| Extra cost | None | Plan-based | Usage-based | Free or usage-based |
Is this your tool? Add a badge