pgvector
activeby Andrew Kane and pgvector contributors · since 2021 · also known as pg_vector, vector extension
The standard Postgres extension for vector similarity search with HNSW and IVFFlat indexes.
Overview
pgvector adds a vector type plus halfvec, bit and sparsevec variants to PostgreSQL, with exact search and approximate HNSW and IVFFlat indexes, so embeddings live in the same rows, transactions and backups as the rest of your data. It is available on essentially every managed Postgres (RDS, Aurora, Cloud SQL, AlloyDB, Azure, Supabase, Neon), which makes it the lowest-friction way to add semantic search to an existing app. Iterative index scans (0.8) fixed the worst filtered-query recall problems. It is comfortable into the tens of millions of vectors; beyond that, index build memory and filtering trade-offs push teams toward pgvectorscale, VectorChord or a dedicated vector database.
Strengths & trade-offs
Strengths
- +Vectors live next to relational data with full ACID and joins
- +Available on virtually every managed Postgres
- +HNSW and IVFFlat with L2, inner product, cosine, L1, Hamming and Jaccard
- +halfvec, binary and sparse vectors cut storage
- +Iterative index scans improve filtered search recall
Trade-offs
- −HNSW index builds are memory-hungry and slow at 100M+ vectors
- −Filtered ANN still trails purpose-built engines
- −No built-in BM25; hybrid search needs Postgres FTS or ParadeDB
- −Scaling beyond one primary needs Citus or sharding
Great for
- +Adding semantic search to an existing Postgres app
- +RAG with permission filtering via SQL joins
- +Recommendations next to product data
- +Deduplication and similarity lookups
Think twice for
- −Billion-vector collections
- −Very high QPS vector-only workloads
- −Teams not already on Postgres
Capabilities
Native or official first-party support · 15 of 25 tracked
Scale & consistency
- Comfortable data size
- Medium · ≤ 10 TB
- Horizontal scaling
- Addon
- Multi-region
- Read replicas
- Transactions
- Full ACID
- Consistency
- Strong
- Schema
- Strict
- Architecture
- Single node, Primary replica, Client server
- Query languages
- SQL
Bounded by one Postgres primary; HNSW builds want the index in maintenance_work_mem. Citus can shard vector tables.
Deployment
available on · AWS · Google Cloud · Azure · DigitalOcean · Heroku · Render · Railway · Aiven
Ecosystem
Alternatives to pgvector
TigerData's Postgres extension adding StreamingDiskANN indexes on top of pgvector.
pgvector vs pgvectorscale →Disk-friendly Postgres vector extension using IVF + RaBitQ, the successor to pgvecto.rs.
pgvector vs vectorchord →Elasticsearch-quality BM25 search and fast aggregations inside Postgres via the pg_search extension.
pgvector vs paradedb →Rust vector search engine with rich payload filtering, quantization and a managed cloud.
pgvector vs qdrant →Fully managed serverless vector database with built-in embedding, reranking and assistants.
pgvector vs pinecone →Dependency-free SQLite extension for vector search that runs anywhere SQLite does, including WASM.
pgvector vs sqlite-vec →pgvector FAQ
What is pgvector?
pgvector is a vector database by Andrew Kane and pgvector contributors, first released in 2021. pgvector adds a vector type plus halfvec, bit and sparsevec variants to PostgreSQL, with exact search and approximate HNSW and IVFFlat indexes, so embeddings live in the same rows, transactions and backups as the rest of your data. It is available on essentially every managed Postgres (RDS, Aurora, Cloud SQL, AlloyDB, Azure, Supabase, Neon), which makes it the lowest-friction way to add semantic search to an existing app. Iterative index scans (0.8) fixed the worst filtered-query recall problems. It is comfortable into the tens of millions of vectors; beyond that, index build memory and filtering trade-offs push teams toward pgvectorscale, VectorChord or a dedicated vector database.
Is pgvector open source?
Yes. pgvector is open source. License: PostgreSQL License.
Does pgvector support ACID transactions?
Yes. pgvector supports full ACID transactions, with strong consistency.
Does pgvector scale horizontally?
pgvector scales horizontally through an official extension, proxy or edition rather than in the core engine. It is comfortable at medium scale (≤ 10 TB). It supports cross-region read replicas.
How can I run pgvector?
You can self-host it. Managed offerings include Amazon RDS / Aurora PostgreSQL, Cloud SQL / AlloyDB, Azure Database for PostgreSQL and Supabase. It is available on AWS, Google Cloud, Azure, DigitalOcean and Heroku.
What is pgvector best for?
pgvector is a strong fit for adding semantic search to an existing Postgres app, RAG with permission filtering via SQL joins and recommendations next to product data. Think twice for billion-vector collections.
What are the best alternatives to pgvector?
Common alternatives to pgvector include pgvectorscale, VectorChord, ParadeDB, Qdrant and Pinecone. The right choice depends on your workload, scale and hosting; WhichDB's smart match ranks them against your requirements.
How popular is pgvector?
pgvector ranks #44 of 844 databases on the WhichDB Score (40.0/100), and #4 among vector databases. The score combines public adoption signals such as package downloads, GitHub activity, job posts and developer discussion.