Skip to content
pgvector logo

pgvector

Postgres extension that adds vector types and approximate nearest neighbour indexes, so embeddings live in the same database as the rest of your data.

4.5/5 my assessment
Open-source
SoftwareArtificial Intelligence

Overview

This is an extension, not a product. You run CREATE EXTENSION vector, add a column, build an index and you have similarity search inside the database that already holds your users, orders and documents. The 0.8 line supports Postgres 13 and up, ships HNSW and IVFFlat, and adds halfvec for half-precision storage plus sparsevec for SPLADE or BM25-style sparse embeddings.

The failure modes are well documented. Mostly they are about memory. An HNSW index over 10 million 1536-dimension vectors can reach 80 to 120GB, and building it wants the graph resident, so the 64MB maintenance_work_mem default silently drops you into a disk build measured in hours rather than minutes. Teams that re-embed often also hit MVCC bloat, because an updated row rewrites both the vector and its index entry. None of that argues against pgvector. It argues for sizing the box properly and reading the release notes.

Reach for it when your corpus sits in the low millions, your filters are relational and you would rather tune one database than operate two. Skip it if you need sub-20ms p99 under real concurrency, if you are heading toward a hundred million vectors, or if first-class hybrid retrieval matters more than operational simplicity. One housekeeping note: 0.8.2 fixed a buffer overflow in parallel HNSW builds, tracked as CVE-2026-3172, so anything pinned below that should move.

Key Features

  • Four vector types: vector, halfvec, bit and sparsevec, each up to 16,000 dimensions or non-zero elements
  • HNSW and IVFFlat approximate nearest neighbour indexes, with parallel HNSW builds
  • Six distance operators covering L2, inner product, cosine, L1, Hamming and Jaccard
  • Iterative index scans from 0.8 onward, which stop a selective WHERE clause from returning three rows when you asked for twenty
  • halfvec half-precision storage that roughly halves index size at small recall cost
  • Runs on Postgres 13 and up, released under the permissive PostgreSQL licence

Where it holds

  • Embeddings join directly to your rows. No second system to keep in sync, no dual-write bug at 3am.
  • Free, and already available on every managed Postgres worth using, so evaluation costs an afternoon rather than a procurement cycle.
  • You inherit transactions, point-in-time backups, replication and row-level security that your team already knows how to operate.

Where it breaks

  • Performance falls off somewhere past 10 to 20 million vectors, depending on dimension and hardware.
  • HNSW builds want the graph in memory. Leave maintenance_work_mem at its 64MB default and Postgres quietly drops to a disk-based build that can run 10 to 50 times slower.
  • Heavy re-embedding churns rows and creates MVCC bloat that autovacuum handles badly.
  • No native BM25, so hybrid retrieval means bolting on tsvector or reaching for something like ParadeDB.

My Take

The answer is usually already running on port 5432. Version 0.8.6 landed on 29 July 2026 and the extension now covers four vector types, six distance operators and iterative scans that keep recall honest under filtering. It does run out: past roughly 10 to 20 million vectors the HNSW index stops sitting comfortably in page cache and p99 goes ragged, which is where Qdrant or Milvus start to earn their operational cost. Below that line, a second datastore is a liability nobody asked for.

Francis Okafor
Francis Okafor AI & Tech Lead · Engineer

Quick Info

Pricing:
open-source
Openness:
Open source
Licence:
PostgreSQL License
Starting at:
Free under the PostgreSQL licence. No paid tier, no vendor, no per-vector metering. The only cost is the Postgres instance itself, and memory is what you actually pay for: an HNSW index over 10 million 1536-dimension vectors runs 80 to 120GB and wants to stay resident, which sets your instance size. Preinstalled and free of surcharge on RDS, Cloud SQL, Supabase and Neon.
Added:
Aug 2026
Updated:
Aug 2026

Use Cases

software development knowledge management data analysis agent development

Judge it on your own work

The notes above say where pgvector holds and where it breaks. The fastest check is your own workload.

Visit website ↗

pgvector compared head to head

Alternatives to pgvector