
pgvector review
Postgres extension that adds vector types and nearest neighbour search to your existing database
Chandan Kumar is a founder of Geekflare. He is a technology enthusiast and entrepreneur who loves to help businesses and people around the world. Chandan has worked at BNP Paribas, Citibank, Deutsche Bank, Motorola, and HP. He’s got an in-depth understanding of business software and IT infrastructure.
Verdict
pgvector is the simplest choice if you already run Postgres, because vectors live next to your other tables with joins, transactions, backups and replication you already have. Filtered vector searches need tuning, indexes are limited to 2,000 dimensions for full-precision vectors, and scaling past one large server means sharding Postgres with a separate tool.
Best for
Teams already on Postgres that want vector search without a new database
Not for
Very large vector sets that need sharding built in
Pros
- Vectors sit in normal tables with joins, transactions and point-in-time recovery
- Available on most managed Postgres services
- Half-precision, binary and sparse vectors for smaller indexes
- Works with standard Postgres replication and backups
Cons
- Filters apply after the index scan, so filtered queries need tuning
- Full-precision indexes stop at 2,000 dimensions
- No built-in sharding; you need Citus or a similar tool
“Pgvector is definitely the easiest way to get started.”
Hacker News, Mar 2026“Postgres and PGVector works for me.”
Hacker News, Jun 2026“that's the thing that kills performance in pgvector”
Hacker News, Dec 2025
Is pgvector right for your project?
Describe what you need and AI will check the fit against this review.
pgvector features and capabilities
Vectors in your existing database
Embeddings go in an ordinary column next to your data, so one SQL query can join, filter and rank by similarity without syncing a second database.
HNSW and IVFFlat indexes
You can run exact search for perfect recall or add an HNSW or IVFFlat index for faster approximate search, and choose per table.
Smaller indexes with quantization
Half-precision and binary quantized indexes cut index size, index up to 4,000 or 64,000 dimensions, and can re-rank with the full vectors for recall.
Iterative scans for filtered queries
Since 0.8.0 an index scan can keep going until enough rows pass your WHERE filter, which avoids short result lists on filtered searches.
Hybrid search with Postgres full-text search
Postgres full-text search can run beside vector search, and the project gives a Reciprocal Rank Fusion example to merge the two lists.
- Hybrid searchCombines keyword and vector search in one query
- PartlyCombine with Postgres full-text search in SQL; you write the fusion
- Built-in embeddingsTurns text into vectors for you, so you don't call an embedding API yourself
- No
- QuantizationCompresses vectors to cut memory
- YesHalf-precision and binary quantization; no product quantization
- Disk-based indexServes indexes bigger than memory from SSD
- PartlyIndexes are normal Postgres pages and can exceed RAM, but run best in memory
- Sharding and replicationSpreads data across nodes in the free version
- PartlyPostgres replication; sharding needs Citus or another tool
- Multi-tenancyKeeps each customer's data apart in one database
- YesList partitioning or separate tables per tenant
- Embedded modeRuns inside your app with no separate server
- NoRuns inside a Postgres server
At a glance
- Type
- Postgres extension
- Stack
- C (Postgres extension)
- Databases
- PostgreSQL 13+
- SSO
- Via plugin
- Roles and permissions
- Free edition
- Audit logs
- Via plugin
Free vs paid editions
What you get when you self-host, and what needs a paid plan.
pgvector is free under the PostgreSQL License, and every feature is in the open source extension. Its authors sell no paid edition or cloud, but most managed Postgres services include it, such as Amazon RDS, Google Cloud SQL, Supabase and Neon, so you pay whatever your Postgres host charges.
Self-hosting pgvector
pgvector gives no minimum requirements and runs on Postgres 13 or later. Its FAQ says indexes do not have to fit in memory, but queries are faster when they do.
New cloud server to ready
12 s
Memory in use at idle
28 MB of 4 GB
Load and index 100,000 vectors
2 min 23 s, 852 MB peak
Recall@10
95.4%
Median search
6.6 ms
Slowest 5%
10.1 ms
Version tested
0.8.7 · Oct 19, 2026
- The official image with PostgreSQL 18 was ready in 12 seconds. I gave the container 1 GB of shared memory, since parallel index builds use it and Docker's default is 64 MB.
- COPY loaded 100,000 rows in 11 seconds. Building the HNSW index afterwards took 2 minutes 12 seconds with maintenance_work_mem at 1 GB, as the README recommends.
- At the default hnsw.ef_search of 40 it found 95.4% of the true top 10 at a median of 6.6 ms. Raising it to 100 gave 98.4% at 8.3 ms.
- Docker reported 229 MB after the load, because Postgres keeps most of its data in the operating system's page cache.
# pgvector/pgvector:0.8.7-pg18-trixie, shm_size 1g, port on 127.0.0.1
import psycopg
from pgvector.psycopg import register_vector
conn = psycopg.connect(DSN, autocommit=True)
conn.execute("CREATE EXTENSION IF NOT EXISTS vector")
register_vector(conn)
conn.execute("CREATE TABLE items (id int PRIMARY KEY, title text, embedding vector(1536))")
with conn.cursor().copy("COPY items (id, title, embedding) FROM STDIN WITH (FORMAT BINARY)") as copy:
copy.set_types(["int4", "text", "vector"])
for i, (vec, title) in enumerate(zip(vectors, titles)):
copy.write_row([i, title, vec])
conn.execute("SET maintenance_work_mem = '1GB'") # as the README advises
conn.execute("CREATE INDEX ON items USING hnsw (embedding vector_cosine_ops)")
rows = conn.execute("SELECT id FROM items ORDER BY embedding <=> %s LIMIT 10", (query,)).fetchall()[
{"id": 1004, "title": "Apache HTTP Server", "distance": 0.1209},
{"id": 99963, "title": "Web container", "distance": 0.1388},
{"id": 20767, "title": "Java servlet", "distance": 0.1433},
{"id": 20383, "title": "JavaServer Pages", "distance": 0.1463},
{"id": 396, "title": "Apache Software Foundation", "distance": 0.1474}
]What you can do with pgvector
Semantic search in an existing app
Add an embedding column to your products, articles or tickets table and rank results by similarity in the same SQL query.
RAG on a managed Postgres
Keep document chunks and their vectors in the Postgres you already run on RDS, Cloud SQL, Supabase or Neon.
Per-customer retrieval in SaaS
Partition vectors by customer and use Postgres roles and row-level security to keep each tenant's data apart.