Capability · Framework — rag

pgvector

pgvector brings vector search into the Postgres you already run. You add an extension, create a column of type vector(n), and use ORDER BY embedding <=> $1 LIMIT 10 to query. For many RAG workloads — millions of vectors, strong filtering, existing SQL data — it's the simplest and cheapest option.

Framework facts

Category
rag
Language
C / SQL
License
PostgreSQL
Repository
https://github.com/pgvector/pgvector

Install

# From source
make && sudo make install
# Or via managed PG (Supabase, Neon, RDS) — enable the extension
CREATE EXTENSION IF NOT EXISTS vector;

Quickstart

-- schema
CREATE TABLE docs (id bigserial PRIMARY KEY, text text, emb vector(1536));
CREATE INDEX ON docs USING hnsw (emb vector_cosine_ops);

-- insert
INSERT INTO docs (text, emb) VALUES ('hi', '[0.1, 0.2, ...]');

-- query
SELECT text FROM docs ORDER BY emb <=> '[0.1, 0.2, ...]' LIMIT 5;

Alternatives

  • pgvectorscale — TimescaleDB's faster variant
  • Milvus — dedicated vector DB
  • Qdrant — standalone Rust engine
  • LanceDB — embedded vector DB

Frequently asked questions

How far does pgvector scale?

Comfortably to tens of millions of vectors on one node with HNSW. Beyond that consider pgvectorscale (StreamingDiskANN) or a dedicated vector DB.

Does pgvector support hybrid search?

Yes — combine it with tsvector/BM25 via pg_trgm or a hybrid ranking CTE. Supabase publishes patterns for this.

Sources

  1. pgvector — GitHub — accessed 2026-04-20
  2. Supabase — pgvector guide — accessed 2026-04-20