pgvector
pgvector is an open-source PostgreSQL extension for vector search, indexing, and similarity queries inside your Postgres database.
Reviewed by Mathijs Bronsdijk · Updated Apr 13, 2026

What is pgvector?
pgvector is an open-source PostgreSQL extension for storing, indexing, and querying vectors for similarity search directly in Postgres databases. It adds vector data types, similarity operators such as cosine distance and L2, and indexing methods including HNSW and IVFFlat to PostgreSQL. Teams install it in Postgres, create vector columns, store embeddings, and run nearest neighbor searches with SQL instead of using a separate vector store. It is for developers and product teams building AI applications such as semantic search, recommendations, and retrieval-augmented generation systems.
Key Features
- vector data type: Stores high-dimensional vectors as native PostgreSQL columns with fixed dimensions, so teams can keep embeddings and structured data in one database and query both with standard SQL and atomic transactions.
- Vector similarity operators: Supports L2, inner product, and cosine distance in SQL, so users can run nearest neighbor search and combine it with filters such as recency or permissions in the same query.
- IVFFlat index: Uses approximate nearest neighbor indexing to narrow the search space on large datasets, which can reduce query latency for vector search workloads.
- HNSW index: Adds a graph-based approximate nearest neighbor index, and PostgreSQL can choose it or exact indexes based on planner estimates for better recall and query performance.
- Iterative index scans: Continues searching HNSW or IVFFlat indexes when initial filtered scans return too few results, which helps avoid incomplete results in filtered vector queries.
- Improved filter estimation: In pgvector 0.8.0+, improves PostgreSQL cost estimates for HNSW and IVFFlat under WHERE filters, so the planner can pick B-tree indexes for exact matches when they are faster.
- pgvector-python: The official Python library connects pgvector to Python workflows, so developers can use vector operations in PostgreSQL without building custom bindings.
- pgvector-node: Supports Node.js, Deno, Bun, and TypeScript, with ORM compatibility for Prisma, Drizzle, and Sequelize, so JavaScript and TypeScript teams can add vector search to existing app stacks.
Use Cases
-
Mid-size SaaS engineer managing internal search: Stores embeddings for 2M internal documents in PostgreSQL with pgvector and joins vector search with permission data in SQL. The reported result is $0 new infrastructure costs, 95% recall, and p95 latency below 100ms.
-
Groovy Web deployment engineer: Migrates datasets under 10M vectors from Pinecone to pgvector and builds HNSW indexes in PostgreSQL RDS for RAG pipelines and recommendation systems. Reported outcomes include 45% average cost savings versus Pinecone, migration in 3 to 5 days, and p95 latency under 15ms at 2M vectors.
-
Instacart data engineer: Uses pgvector in production inside an existing PostgreSQL setup for recommendation or search features. Public deployment reports note operation at significant scale within single-node PostgreSQL limits, around 50M vectors.
-
Supabase database administrator: Runs pgvector for customer workloads, using the 0.7+ series with HNSW and parallel index builds. Public reports describe production-grade performance and improved memory management for significant scale.
-
Neon Postgres optimizer: Deploys pgvector with pgvectorscale for customer embeddings and tunes DiskANN or HNSW indexes for semantic search. Public 2026 benchmarks describe production reliability at moderate-to-large scale within Postgres limits.
Strengths and Weaknesses
Strengths:
- Hacker News discussions (January 2024) describe pgvector as a good fit for small to moderate scale workloads. One commenter says they would "stick with PgVector until you're dealing with non trivial scale."
- Hacker News performance discussions (October 2024) cite a benchmark on 50 million Cohere embeddings with 768 dimensions, where PostgreSQL with pgvector and pgvectorscale reached 28x lower p95 latency and 16x higher query throughput than Pinecone's storage optimized (s1) index, with 75% lower cost when self-hosted on AWS EC2.
- Hacker News threads (April 2025) show active public support around pgvector tuning and architecture. In one discussion, the poster explicitly invited questions about "architecture, pgvector tuning, or anything else."
Weaknesses:
- Hacker News sentiment summarized in the research data is mixed positive, with caution around scale. The same January 2024 discussion that praised pgvector for moderate workloads also suggests limits appear at "non trivial scale."
- The limitations data states that pgvector struggles at large scales, but no direct quote or benchmark is documented in that source. That means the scaling concern appears in sentiment summaries, but the evidence here is limited.
Getting Started
- Free forever tier: Free. Fully available as an open-source PostgreSQL extension and self-hosted on any PostgreSQL instance, PostgreSQL 11+ required. No stated limits on vectors, indexes, or queries.
Costs depend on the PostgreSQL hosting provider, since pgvector does not list official paid tiers.
Who Is It For?
Ideal for:
- Backend developer at a mid-market company building RAG applications: pgvector fits teams that already run Postgres and want vector similarity search in the same database as relational data. It supports embedding storage and retrieval with SQL joins to metadata, so there is no need for a separate vector database.
- Data engineer at a growth-stage AI or ML startup: pgvector is a match when your team needs approximate nearest neighbor indexes in Postgres, including HNSW and IVFFlat, for semantic search on embeddings. It works well for teams with 5 to 50 engineers and database admins that want to keep a Postgres-based stack.
- Full-stack engineer on a small team using ORMs: pgvector fits app teams working with tools like SQLAlchemy, Prisma, Drizzle, Django, Next.js, Go/pgx, OpenAI, or Cohere. It supports hybrid SQL and vector queries inside the application stack developers already use.
Not ideal for:
- Non-technical users or analysts: pgvector requires SQL skills and Postgres administration, so a managed vector service like Pinecone or Weaviate is a better fit.
- Teams that need sub-100ms filtered ANN queries at 1B+ scale without self-management: Dedicated systems such as Vespa, Qdrant, Milvus, or pgvectorscale are a better choice for that workload.
Use pgvector if your team is committed to Postgres, builds semantic search or RAG features, and wants to keep vector search close to application data with familiar SQL. Skip it if you are not on Postgres, lack database tuning capacity, or need very high query throughput at very large scale.
Alternatives and Comparisons
-
Pinecone: pgvector does better when teams want vector search inside an existing PostgreSQL stack, with self-hosting, local queries, and reported 45% cost savings at equivalent scale. Pinecone does managed scaling better, with zero operational overhead, support to billions of vectors without sharding, and higher QPS at scale. Choose pgvector if you already use Postgres and have under 50M vectors; choose Pinecone if managed operations matter more. Switching difficulty is listed as medium.
-
Qdrant: pgvector does better when the goal is to keep relational data and vector search in one PostgreSQL system, and it supports hybrid search through PostgreSQL text search. Qdrant does pure vector workloads better, with stronger performance for self-hosted RAG setups and native payload filtering in Rust. Choose pgvector if you want unified data management on Postgres; choose Qdrant if vector performance matters more than relational features.
-
Weaviate: pgvector does better for Postgres-centric workloads at moderate scale, with lower latency under 10M vectors and PostgreSQL ACID compliance for transactional use cases. Weaviate does large-scale deployments better, with native distributed scaling past 1B vectors and built-in BM25 plus vector fusion. Choose pgvector if you want relational and vector storage together in Postgres; choose Weaviate if you need large-scale hybrid search across many tenants.
Getting Started
Setup:
- Signup: No signup or free trial is documented in the available data. Setup usually starts with a
docker-compose.ymlfile and database connection environment variables. - Time to first result: Public guides put first results at about 15 to 30 minutes.
Learning curve:
- pgvector requires writing application code and is not a UI-driven tool. Useful background includes Python, PostgreSQL, Docker or cloud database experience, plus a basic understanding of embeddings and vector similarity.
- Beginner: 1 to 2 hours. Experienced: 15 to 30 minutes.
Where to get help:
- GitHub Discussions exists, but available data does not document response times or clear responsiveness. The repository shows ongoing maintenance, though user-reported support quality is not documented.
- There are no documented official Discord, Slack, forum, email, or live chat channels in the available data.
- Community support appears small and technical, and discussion spaces are described as mostly unanswered. Third-party content is growing, but it is mainly tutorial-focused.
Watch out for:
- Local development may depend on Docker, which can add setup work before you test queries.
- Early schema design choices and embedding generation can slow progress if you are new to vector search.
Integration Ecosystem
Users describe pgvector's integration ecosystem as narrow but focused around PostgreSQL workflows. Reports point to reliable day to day use when teams stay inside the Postgres stack, and most complaints focus on index and performance tuning rather than broken connections. No MCP server availability is noted in the research.
- LangChain: Users say the LangChain integration works fine for adding vector search to LLM apps, with simple Docker-based setup and some friction when scaling high-dimensional embeddings.
- LlamaIndex: Users praise LlamaIndex support for RAG pipelines, where pgvector handles storage and retrieval reliably, though some say manual index tuning is needed for better recall.
- PostgreSQL clients (psycopg2, asyncpg): Users often discuss these clients as the main way they use pgvector in Python and Node.js apps, and describe it as a natural extension of Postgres that runs reliably in production.
What users ask for most often is easier migration from managed vector databases such as Weaviate and Qdrant, plus a direct GUI for embedding ingestion. Some also want native ties to Streamlit and Gradio for quick demos.
Developer Experience
pgvector is a PostgreSQL extension that adds vector similarity search inside Postgres. The developer surface is SQL-first, so teams work through native database queries instead of a separate API or hosted service. Public research for docs quality and time to first result is limited.
What developers like:
- Developers describe pgvector as fast and say the API is excellent.
Security and Privacy
Product Momentum
- Release pace: Community signals point to steady activity, with releases every few months and a detailed public changelog that tracks ongoing performance work.
- Recent releases: In October 2024, v0.8.0 added iterative index scans, sparsevec casts, and HNSW optimizations. Public release notes describe a positive response to these performance updates.
- Growth: pgvector appears stable, with an open source community model and adjacent projects such as Timescale's pgvectorscale building on it for larger-scale workloads.
- Search interest: No Google Trends direction was provided in the available research.
- Risks: No notable controversy was documented, but pgvector depends on Postgres core stability and a small maintainer team.
FAQ
What is pgvector?
pgvector is an open-source PostgreSQL extension that adds vector storage, querying, and indexing to PostgreSQL. It is used for similarity search, retrieval-augmented generation (RAG), and machine learning workflows.
What is pgvector used for?
pgvector is used to store embeddings in PostgreSQL and run similarity search with SQL. Common use cases include RAG, semantic search, and machine learning workflows.
Is pgvector free?
Yes. Pgvector is open source and has no official pricing tiers. Costs depend on where you host PostgreSQL.
Do I need PostgreSQL to use pgvector?
Yes. Pgvector is a PostgreSQL extension and runs on PostgreSQL instances. The research notes PostgreSQL 11+ is required for self-hosting.
How do I install pgvector on Linux?
Install PostgreSQL development headers first, such as postgresql-server-dev-16. Then clone the repository, build it with make, and run sudo make install.
Does pgvector support Python?
Yes. The pgvector-python library supports Django, SQLAlchemy, SQLModel, Psycopg 3, Psycopg 2, asyncpg, pg8000, and Peewee.
Can pgvector store vectors directly in PostgreSQL tables?
Yes. Pgvector adds a native vector data type for PostgreSQL columns. Vectors use fixed dimensions set when the column is created.
Does pgvector support vector indexing?
Yes. The research states pgvector adds indexing for vector search in PostgreSQL. It also notes HNSW indexing with reported p95 latency of 5 to 12 ms at 1M vectors.
How does pgvector compare with a standalone vector database?
pgvector adds vector search to an existing PostgreSQL deployment, so teams can keep structured data and vectors in one system. It is often used by teams that want to avoid vendor lock-in and work with familiar SQL.
Is pgvector good for RAG applications?
Yes. The research specifically lists retrieval-augmented generation as a common use case. It is often used to add semantic retrieval to LLM applications.
What integrations are commonly used with pgvector?
The research highlights LangChain as a common integration for LLM applications. Python support is also available through multiple database and ORM libraries.
How long does it take to get started with pgvector?
The research estimates 15 to 30 minutes to first result. Setup notes include creating a docker-compose.yml file and setting database connection environment variables.
Can I self-host pgvector?
Yes. The pricing research describes pgvector as fully available for self-hosting on any PostgreSQL instance that meets the version requirement. There is no official hosted plan listed in the research.
Does pgvector have official pricing plans or a free trial?
No official pricing tiers or free trial are listed in the research. Pgvector is distributed as an open-source PostgreSQL extension.