pgvector
PostgreSQL extension for vector similarity search. Store embeddings alongside relational data in your existing Postgres database with HNSW and IVFFlat indexes.
pgvector is an open-source PostgreSQL extension that adds vector similarity search capabilities to the world’s most popular open-source relational database. It lets you store embeddings as a native column type alongside your existing relational data and perform similarity searches using SQL queries. For teams already running PostgreSQL who want to add vector search without introducing a separate database, pgvector eliminates operational complexity by keeping everything in one place.
Key Features
Native PostgreSQL integration. pgvector adds a vector column type and distance operators directly to PostgreSQL. Store embeddings alongside users, documents, products, and other relational data in the same database, the same tables, and the same transactions. No separate system to manage, backup, or secure.
Standard SQL queries. Perform vector similarity search using familiar SQL syntax with operators for L2 distance, inner product, and cosine distance. Combine vector search with WHERE clauses, JOINs, GROUP BY, and other SQL operations in a single query. This is unique among vector stores — no new query language to learn.
HNSW and IVFFlat indexes. pgvector supports HNSW (Hierarchical Navigable Small World) indexes for fast approximate nearest neighbor search and IVFFlat indexes for partitioned search. Both index types are configurable for your desired speed-recall trade-off.
ACID compliance. Vector data participates in PostgreSQL’s full ACID transaction guarantees. Embeddings are consistent with their associated relational data — no eventual consistency concerns or synchronization issues between separate databases.
Existing infrastructure. Use your existing PostgreSQL hosting, whether that is a managed service (AWS RDS, Google Cloud SQL, Supabase), a self-hosted instance, or a Docker container. No new infrastructure to provision, monitor, or pay for.
Ecosystem compatibility. pgvector integrates with LangChain, LlamaIndex, Haystack, Django, Rails, and every language with a PostgreSQL driver. Any tool that can talk to Postgres can use pgvector.
When to Use pgvector
Choose pgvector when you already run PostgreSQL and want to add vector search without operational overhead. It is the right choice for applications where embeddings are tightly coupled with relational data, teams that want a single database to manage, and projects where introducing a separate vector database is not justified by scale requirements.
Ecosystem Role
pgvector is the pragmatic choice for teams that do not want to operate a separate vector database. It trades the specialized performance of Qdrant or Weaviate for operational simplicity and relational data colocation. For small-to-medium datasets (millions of vectors), pgvector performs well. For billion-scale dedicated vector search, purpose-built databases like Qdrant or FAISS are more appropriate.