PG Vector

PG Vector is a popular Postgres extension that adds vector search capabilities directly inside a traditional relational database. It is ideal for teams that want to keep embeddings, metadata, and application data in one system without operating a separate vector database. If you want to compare the best vector databases for your data, try Agentset.

Rank: #6License: PostgreSQLCost: low

Vector Databases Are Just One Piece of RAG

Agentset gives you a managed RAG pipeline with the top-ranked models and best practices baked in. No infrastructure to maintain, no vector database to operate.

Trusted by teams building production RAG applications

5M+
Documents
1,500+
Teams
99.9%
Uptime

Deployment

Self-Hosted, Managed Cloud

Cost

Free (extension), infra cost only

Index Types

Flat, IVFFlat, HNSW

Deployment

Infrastructure Options

Deployment Types

  • Self-Hosted
  • Managed Cloud

Cloud Providers

  • AWS RDS
  • Azure Postgres
  • GCP AlloyDB
  • Supabase
  • Timescale

Strengths

What PG Vector Does Well

  • No separate vector database to manage
  • Unified data layer (vectors + metadata + relational data)
  • Leverage existing Postgres infrastructure and expertise
  • ACID transactions with vectors and relational data
  • Works with all Postgres tooling and ecosystem
  • Free and open-source extension
  • Excellent for hybrid SQL + vector queries
  • Mature backup, replication, and monitoring tools
  • Easy integration with existing Postgres apps

Weaknesses

Potential Drawbacks

  • Performance limited by Postgres constraints
  • Not optimized for billion+ vector scale
  • HNSW index can be memory-intensive
  • Slower than specialized vector databases at scale
  • Limited to 2,000 dimensions (vector), 4,000 (halfvec)
  • Vector operations can impact transactional workload
  • Index building can be slow for large datasets

Use Cases

When to Choose PG Vector

Ideal For

  • Applications already using PostgreSQL
  • Teams wanting unified data layer
  • Projects needing transactional consistency with vectors
  • Small to medium vector datasets (millions)
  • Applications requiring complex SQL joins with vectors
  • Cost-conscious projects with existing Postgres
  • Rapid prototyping with familiar tools

Not Ideal For

  • Applications needing billions of vectors
  • Very high-performance vector search requirements
  • Greenfield projects not tied to Postgres
  • Applications needing specialized vector features
  • High-throughput vector-only workloads

Build RAG in Minutes, Not Months

Agentset gives you a complete RAG API with fully managed vector storage and retrieval. Upload your data, call the API, and get accurate results from day one.

import { Agentset } from "agentset";

const agentset = new Agentset();
const ns = agentset.namespace("ns_1234");

const results = await ns.search(
  "What is multi-head attention?"
);

for (const result of results) {
  console.log(result.text);
}