
Vector Databases in 2026: pgvector vs Pinecone vs Qdrant vs Weaviate vs Milvus
A hands-on 2026 comparison of the five vector databases I actually ship — pricing, latency, hybrid search, filtering, sharding, re-embed cost, and the decision tree I use in client architecture reviews.
pgvector wins for teams already on Postgres and under ~10M vectors. Qdrant is my default for standalone. Pinecone if you want zero ops and can afford it. Weaviate for schema-rich hybrid search. Milvus for billion-scale with a dedicated ops team. This is the exact matrix and decision tree I walk through in architecture reviews, plus the hidden costs (re-embed, egress, filter selectivity) that flip the winner mid-project.
- Start with pgvector — 90% of RAG apps never need to leave Postgres.
- Hybrid search (BM25 + vector) beats pure vector search on almost every real corpus.
- Filter selectivity, not raw ANN speed, decides p95 latency once you cross 1M docs.
- Managed services save you a hire; self-hosted saves you $2k+/mo at scale. Do the math per year, not per month.
- Re-embed cost is the hidden killer — pick a store that supports lazy re-index and dual-write.
- Pick the embedding model BEFORE the store: dimension × count decides storage and often changes the winner.
Why 'just use a vector DB' is the wrong question
A vector database is a search index, not a source of truth. The interesting decisions are: which index type, how to combine with lexical search, how to filter by metadata efficiently, how to re-embed without downtime, and how to pay for the storage. This article walks the trade-offs I've hit shipping RAG across 20+ projects.
It pairs with RAG that actually works (which explains why hybrid + rerank beats pure ANN), Postgres for product engineers (the base you're extending with pgvector), evaluating LLMs and classical ML (how to know if your retriever improved), and observability for AI systems (what to trace in retrieval).
The comparison matrix (2026 production numbers)
Every column below reflects behavior at 1M vectors, 1024-dim embeddings, and hybrid queries with metadata filters, on comparable hardware. Numbers rounded from my own load tests — treat as within ±20%.
| Feature | pgvector | Pinecone | Qdrant | Weaviate | Milvus |
|---|---|---|---|---|---|
| Ops model | Self-host (Postgres) | Fully managed | Self-host or Cloud | Self-host or Cloud | Self-host, hard |
| Cost @ 1M vec | ~$25/mo | ~$70/mo | ~$30/mo | ~$50/mo | ~$40/mo (heavy) |
| Hybrid search | DIY (tsvector + RRF) | Built-in | Native (BM25 + dense) | Native | Via plugin |
| Metadata filter | SQL — anything | Basic | Rich payload | Rich schema | Basic |
| Pre-filter perf | Excellent (SQL planner) | OK | Excellent (payload index) | Good | OK |
| p95 latency | ~40ms | ~30ms | ~25ms | ~35ms | ~20ms |
| Billion-scale | No | Yes | Yes | OK | Best |
| Multitenant | RLS (native) | Namespaces | Collections + payload | Multi-tenancy built-in | Partitions |
| Learning curve | Easy | Easy | Easy | Medium | Hard |
A quick heuristic: if your total corpus fits in RAM on a $200/mo VM, pgvector wins on total cost of ownership. Cross that line and Qdrant is my next default.
Index types you actually need to understand
The store name matters less than the index inside it. Every serious ANN store exposes some subset of:
| Index | Build time | Query latency | Recall knob | Memory | When to pick |
|---|---|---|---|---|---|
| Flat (brute force) | Zero | O(N) | 100% by definition | Low | < 100k vectors, or truth-set for evals |
| IVF-Flat | Fast | Fast at small k | nprobe | Low | 1M–10M vectors, cheap infra |
| IVF-PQ | Fast | Fast | nprobe + m/nbits | Very low | 100M+ vectors, memory-constrained |
| HNSW | Slow (build) | Very fast | efSearch, M | High | Default for < 100M with RAM |
| DiskANN | Slow | Fast on SSD | L, R | Low RAM | Billion-scale, budget-conscious |
Almost all production RAG in 2026 is HNSW with efSearch tuned per query — that gets you 95%+ recall at 20ms. Move to IVF-PQ or DiskANN only when the RAM bill actually hurts.
Filter selectivity: the hidden latency killer
Once you cross ~1M docs, pure ANN speed matters less than how well the store combines a metadata filter with the vector search. Three strategies:
- Post-filter — run ANN, then drop rows that fail the filter. Fast if filter is loose, disastrous if filter is tight (you retrieve 10k to keep 5).
- Pre-filter — apply the filter first, then ANN only over the candidate set. Requires a payload index. Qdrant and Weaviate excel here.
- Query planner — decide per query based on estimated selectivity. pgvector gets this for free from Postgres' planner.
If your app filters by tenant, language, doc-type, and date on every query — and most do — pre-filter or planner-based stores will beat ANN-only stores by 3–10× at p95.
Hybrid search: BM25 + vector wins almost always
Pure dense search misses exact identifiers (SKUs, error codes, names) and pure BM25 misses paraphrases. Reciprocal Rank Fusion (RRF) of the two top-N lists is the boring, dominant baseline in 2026.
def rrf(bm25_hits, dense_hits, k=60, top=20):
scores = {}
for rank, doc_id in enumerate(bm25_hits):
scores[doc_id] = scores.get(doc_id, 0) + 1 / (k + rank)
for rank, doc_id in enumerate(dense_hits):
scores[doc_id] = scores.get(doc_id, 0) + 1 / (k + rank)
return sorted(scores, key=scores.get, reverse=True)[:top]pgvector implements this in SQL; Qdrant and Weaviate expose it as a single query. Full pattern with reranking in RAG that actually works.
When each store shines
pgvector — the boring choice that ships
You already run Postgres. You want joins, transactions, RLS on your vectors, and a single backup story. This is the answer 60% of the time.
ivfflat for <1M vectors, hnsw above that. Always ANALYZE after bulk inserts. Add a partial index per tenant if the tenants are very unbalanced.Qdrant — my default for standalone
Rust core, generous free self-hosted, best-in-class filter-then-search. Payload indexing means filter queries stay fast even at 100M vectors. Snapshots and rolling upgrades are painless.
Pinecone — pay to not think about ops
Fastest to production. Serverless tier auto-scales. Pricing gets loud past 10M vectors — do the annual math before committing. Weakness: metadata filtering is thinner than Qdrant/Weaviate.
Weaviate — for schema-first teams
If your RAG has real entities (Product, Author, Article) with typed relationships, Weaviate's schema shines. Built-in modules for embeddings, reranking, and multi-tenancy at scale.
Milvus — the billion-scale monster
Only pick this if you actually need it. The ops complexity is real — separate coord, query, data, index nodes; you'll want a dedicated infra engineer. See parallels in self-hosting n8n on Kubernetes for the operational overhead.
The decision tree I actually use in reviews
- Are you already on Postgres and under 5M vectors? → pgvector. Stop here.
- Do you want zero ops and have budget? → Pinecone.
- Do you need rich metadata filters at 10M+ scale? → Qdrant.
- Do you have complex typed entities and want multi-tenancy first-class? → Weaviate.
- Do you have >500M vectors and a dedicated ops team? → Milvus.
Multi-tenancy: RLS, namespaces, or partitions
SaaS with per-tenant corpora needs a serious answer for isolation. Four common patterns:
- Row-level filter — one collection, tenant_id on every vector, filter in query. Simple, cheap, risky if the filter is ever forgotten.
- Namespace/collection per tenant — hard isolation, but ops burden grows linearly (backups, index rebuilds).
- RLS (pgvector) — Postgres enforces at the row level. Combine with the pattern in Postgres for product engineers. This is my default for SaaS.
- Sharding by tenant — for whales. Route large tenants to dedicated shards, keep small tenants pooled.
Re-embed without downtime
The single biggest hidden cost: re-embedding when you upgrade the model. For 100M vectors at $0.02/1M input tokens with 300-token chunks, a re-embed is ~$600 in API cost alone, plus rewrite time.
The safe pattern is dual-write with lazy read-side migration:
- Add a new column/collection for the new embedding.
- Backfill in batches with a rate limit; monitor cost live.
- Dual-write: every new document embeds into both old and new.
- Behind a feature flag, route reads to the new index for a percent of traffic.
- Once quality holds on the eval set, cut fully and drop the old column.
pgvector supports this trivially (just add a column). Pinecone requires a new index. Qdrant/Weaviate/Milvus support named vector fields on the same collection — plan for that from day one.
Cost math: the numbers that actually swing
Also budget for network egress if you call a hosted embedder from a different region than your vector store — this quietly adds hundreds/month at scale. Route the whole read/write path in one cloud region if you can.
For attributing this to the right feature/customer, wire it into your LLM cost dashboard alongside completion costs.
Testing at scale before you commit
- Load 1M representative vectors with real metadata distribution.
- Run a 1,000-query eval set for recall@10 and NDCG@10.
- Load-test 100 concurrent queries with realistic filters; record p50/p95/p99.
- Simulate a full re-embed and time it end-to-end.
- Kill a node mid-query and observe recovery.
Do this before you sign a contract or commit to a self-hosted stack. Two days of load testing has saved every client I've done it for from a very expensive rewrite six months later.
What about LanceDB, Chroma, SQLite-vss, and the newcomers?
Great for prototyping and local-first apps. I don't yet run them as the primary store in production — the ecosystem around backups, monitoring, replication, and multi-tenant isolation is still thinner than the five in this guide. Revisit yearly; the gap is closing.
Frequently asked
Can I move from pgvector to Qdrant later?
Yes — vectors are just floats. The friction is your metadata schema and query surface. Design the pipeline to write into an abstract 'index' interface from day one and swapping stores becomes a weekend job.
How do I choose an embedding dimension?
Bench recall@10 vs storage at 512, 768, 1024, and 3072 dims. In most RAG the quality plateaus around 1024 for English; multilingual sometimes benefits from higher. See the eval methodology in evaluating LLMs.
Should I store the raw text in the vector DB?
Store an id and a short snippet. Keep the source of truth in your relational store or object storage. This keeps the vector store small, portable, and cheap to re-index.
Is a reranker worth adding?
Almost always — 5–10 point quality wins at trivial cost. Retrieve 50–100 with ANN, rerank to 5–10 with a cross-encoder or a strong LLM. Details in RAG that actually works.
How do I handle deletes and updates?
pgvector — normal DELETE/UPDATE, rebuild index periodically. Qdrant/Weaviate/Milvus support tombstoning with background compaction. Pinecone: upsert on the same id. Test deletion latency early; some stores lag hours before a delete is enforced.
Building something similar?
I help teams ship production-grade AI agents, n8n workflows, and data platforms. Let's talk about what you're building.
Work with me
Islam Gamal
AI, Data & Automation Engineer. I design and ship production AI agents, n8n workflows, and cloud data platforms — with a focus on reliability, cost, and measurable business impact. Founder of Tashghil and Tek bil Arabi.
More from Islam Gamal
RAG That Actually Works: Chunking, Hybrid Search, Reranking, and Evals
The full production playbook: why naïve RAG demos die on the second question, how to chunk, index, retrieve, rerank, cite, evaluate, and cost-engineer a retrieval-augmented system that survives real users.
Postgres for Product Engineers: Indexing, JSONB, RLS, and the 20% That Ships Millions of Users
The Postgres playbook I've used across product teams — index type per workload, JSONB without regret, RLS that doesn't leak or crawl, connection pooling that survives spikes, and the observability that turns guessing into ground truth.
Evaluating LLMs and Classical ML: A Practical Metrics Guide
The metric you pick decides the model you ship. A deep field guide to choosing, computing, and defending metrics for classification, ranking, generation, RAG, and agents — with the traps that catch senior teams.
Browse every article by Islam Gamal on the author page.