pgvector
pgvector is the Postgres extension that adds vector data types, similarity search, and indexes (IVFFlat, HNSW) — turning Postgres into a usable vector database for RAG workloads in 2026.
pgvector ships vector columns (`vector(1536)`), distance operators (`<->` L2, `<#>` inner product, `<=>` cosine), and ANN indexes (IVFFlat, HNSW). Combined with Postgres, it gives you SQL + vectors in one database — no separate Pinecone / Weaviate / Qdrant instance to operate. Trade-offs: pgvector scales to tens of millions of vectors comfortably; dedicated vector DBs scale further and ship features like hybrid search + reranking out of the box. The 2026 sweet spot: pgvector for RAG-in-the-app teams already on Postgres (Supabase, Neon, AWS RDS), dedicated vector DBs for >100M-vector workloads or where vector is the primary access pattern. Most Supabase RAG apps use pgvector.
When to use pgvector
- RAG apps already running Postgres.
- <100M vectors with mixed SQL + similarity queries.
Common mistakes
- Skipping the ANN index — sequential scans of vectors collapse under load.
- Picking IVFFlat when HNSW is the better default — HNSW is faster and more accurate for most workloads.
FAQ
What is pgvector?
pgvector is the Postgres extension that adds vector data types, similarity search, and indexes (IVFFlat, HNSW) — turning Postgres into a usable vector database for RAG workloads in 2026.
When should I use pgvector?
RAG apps already running Postgres. <100M vectors with mixed SQL + similarity queries.
What are the most common mistakes with pgvector?
Skipping the ANN index — sequential scans of vectors collapse under load. Picking IVFFlat when HNSW is the better default — HNSW is faster and more accurate for most workloads.
Related terms
- Vector database — A vector database stores embeddings and performs approximate nearest-neighbor search at scale, the persistence layer behind RAG and semantic search.
- Embeddings — Embeddings are dense numeric vectors that represent the meaning of text, images, or other data, allowing similarity to be measured as vector distance.
- Retrieval-augmented generation (RAG) — Retrieval-augmented generation (RAG) injects relevant documents into the prompt at query time so the model answers from your data instead of its training memory.
Sources
Last updated: 2026-06-01. Raw markdown: https://promtable.com/glossary/pgvector.md.