Postgres with pgvector is enough for most AI applications: in our tests one 16 GB node built and served 1M × 1536-dim vectors hot, with joins, transactional deletes and one bill. A dedicated vector database such as Pinecone, Qdrant, Weaviate or Milvus earns its place past that single-node ceiling, for heavily filtered search over very large collections, or when you want no database operations at all. Below are the measured limits, the real cost of running two systems, and the scenarios where we would pick each.
Every team shipping an AI feature hits the same fork: keep embeddings in the Postgres you already run, or stand up a dedicated engine next to it. We have spent the past year benchmarking pgvector on dedicated hardware and watching teams migrate in both directions, and our answer has gotten more specific, not more diplomatic: below about a million vectors, a dedicated engine usually costs you more in glue code than it returns in performance. Above that, the conversation gets real.
The annoying part is that both camps argue with adjectives. "Blazing fast." "Web scale." "Production grade." So here is the decision with measured numbers attached, including the ones that make Postgres look bad.
What dedicated vector databases do better than Postgres#
Three things, and they are real.
Scale past what one Postgres node can hold. pgvector's HNSW index is built and served on a single node, and the build is memory-bound. We have measured this directly: an 8 vCPU/16 GB machine builds a 1M × 1536-dim HNSW index in about 9 minutes, and a 2M index on the same box simply will not build. Milvus, Qdrant and Pinecone were designed around this wall, with indexes sharded across nodes, quantization, and disk-friendly index variants. At 100M+ vectors, that architecture is not a nice-to-have. It is the only way the workload exists.
Filtered search at enormous scale. Dedicated engines do filter-aware graph traversal, so a highly selective filter over hundreds of millions of vectors does not gut recall or force a giant over-fetch. pgvector 0.8 added iterative index scans, which fixed the worst "my filter ate the result set" cases at small and medium scale, but if you are combining high-cardinality filters with nine-figure vector counts, the purpose-built engines are ahead and we will not pretend otherwise.
Ops you do not have to think about. Pinecone's serverless model means no capacity planning, no index-sizing spreadsheet, no failover drills. You pay per use, which cuts both ways (your bill scales with your success and you cannot tune what you cannot see), but for spiky workloads on a team with zero infrastructure appetite, it is a legitimate draw.
What they do not change: anything that touches your relational data. A filter on a column you already store is a WHERE clause in Postgres and a copied metadata field everywhere else. Which brings us to the other side.
What Postgres does better than a separate vector store#
The production query is never "give me the 10 nearest neighbors." It is the 10 nearest neighbors for this tenant, that this user is allowed to see, from documents that are not archived, joined back to titles and URLs for the prompt. In Postgres that is one statement:
BEGIN;
SET LOCAL hnsw.ef_search = 80;
SELECT d.title, d.url, c.content,
c.embedding <=> $1 AS distance
FROM chunks c
JOIN documents d ON d.id = c.document_id
WHERE c.tenant_id = $2
AND d.status = 'published'
AND d.language = 'en'
ORDER BY c.embedding <=> $1
LIMIT 10;
COMMIT;In a dedicated vector store, that query becomes: denormalize tenant_id, status, and language into metadata at write time, keep that copy in sync forever, run the filtered ANN query, then make a second round trip to Postgres to join back the document fields. Every schema change to documents now has a shadow in your vector store.
A detail in that SQL is load-bearing: SET LOCAL, not SET. Most managed Postgres puts you behind PgBouncer in transaction-pooling mode (on Rivestack, the $29 Solo tier connects through port 6432 exactly this way), and a session-level SET hnsw.ef_search = 80 is silently dropped: your connection goes back to the pool, and the next query runs at the default. Your search still "works," just at a recall you did not choose, and nothing logs a warning. Use SET LOCAL inside the transaction or set it once with ALTER DATABASE app SET hnsw.ef_search = 80. There is a longer treatment in the HNSW tuning guide.
Then there are transactions. Delete a user and their chunks cascade in the same commit: no orphaned vectors, no reconciliation job. In a two-store architecture the delete propagates eventually, and "our chatbot cited a document the customer deleted last week" is not an inconvenience, it is a GDPR incident with your name on the postmortem.
And cost. Managed vector-store pricing is usually metered on usage (storage, reads, writes) or on the resources you provision. Postgres pricing is hardware: a 2 vCPU/4 GB NVMe node at $49/month serves 250k embeddings at around 1,185 QPS with 0.93 recall@10 (4 concurrent clients, p50 3.2 ms). Most products never exceed that workload, and the bill never moves.
The two-system tax, itemized#
Teams budget for the vector database. They rarely budget for the seams.
The sync pipeline. Dual-write or CDC, pick your poison. Dual-writes fail halfway and you end up writing a reconciliation job anyway. CDC means Debezium plus Kafka, or a vendor connector, another moving part with lag, schema-evolution pain, and its own on-call page.
Consistency holes. The vector store is, structurally, a stale index over your real data. Stale means wrong results. Wrong results that include rows the requesting user should not see means your retrieval layer is now a security surface.
Two backup stories. Postgres with pgBackRest restores to Tuesday at 14:02. Your vector store's snapshot is from 03:00. Now your disaster-recovery plan includes a re-sync procedure you have never tested, executed during an incident.
Two monitoring stacks. When retrieval p95 spikes, which system is it? Postgres gives you pg_stat_statements and EXPLAIN ANALYZE; vector-DB observability ranges from decent to a single latency graph.
Model migrations hit twice. Re-embedding with a new model means backfilling two systems and cutting over atomically, which, across two systems, you cannot, exactly.
None of these is fatal. Together they are a recurring cost in engineering time, indefinitely. That is a fine price if the second system buys you something Postgres cannot do. It is a terrible price for 400k vectors.
Measured limits: where single-node pgvector stops#
These are measurements, not extrapolations: dedicated NVMe nodes on Rivestack, same-region clients, clustered 1536-dim embeddings, HNSW at m=16 / ef_construction=64, recall@10 scored against exact KNN. Full methodology is in the NVMe vs cloud SSD benchmark post.
| Node | RAM | Hot-serving capacity (1536d) | Build reality |
|---|---|---|---|
| 2 vCPU / 4 GB | 4 GB | ~350k vectors | 250k builds in ~5 min; 500k took hours; 1M fails |
| 4 vCPU / 8 GB | 8 GB | ~600k vectors | 500k in ~40 min; 1M fails (OOM) |
| 8 vCPU / 16 GB | 16 GB | ~1M vectors | 1M in ~9 min; 2M will not build |
The 500k row on the 4 GB node is not a typo. The build spilled past RAM and ground on for hours. The index worked afterward. The build window did not.
Throughput, with recall attached, because a QPS figure without its recall is marketing, not measurement:
- 4 GB node, 250k vectors: ~1,185 QPS with recall 0.93 (4 clients, p50 3.2 ms); throughput climbs further if you trade recall down. Same-region networking adds only ~0.4 ms over the in-datacenter floor.
- 8 GB node: 250k at recall 0.94 → ~2,949 QPS (16 clients).
- 16 GB node: 250k at recall 0.95 → ~4,465 QPS (16 clients). 1M vectors → ~3,600 QPS at p50 4.2 ms at recall 0.74 (16 clients).
On Solo (1 vCPU / 2 GB, 250k × 1536), ef_search=200 reaches recall@10 0.974 with p50 13.4 ms at 1 client (53 QPS) and p50 35.0 ms at 16 clients (345 QPS). The same index at ef_search=80 is recall@10 0.93, p50 1.3 ms, 712 QPS at 1 client. Starter (2 vCPU / 4 GB) at ef_search=200 holds recall@10 0.988 at 936 QPS and p50 15.6 ms with 16 clients. Those rows are why "just raise ef_search" needs a memory budget.
One more limit, stated plainly: replicas do not buy you read throughput by default. In most managed HA setups, Rivestack's included today, added nodes are streaming-replication standbys for automatic failover, and the load balancer routes every query, reads included, to the primary. Vanilla Postgres can serve reads from hot standbys if you build the routing and accept replication lag, but do not pencil "add a node, double the QPS" into your capacity plan. Scale within a node first.
So the practical line for 1536-dim embeddings is roughly one million vectors per node at 16 GB of RAM. Past it, your in-Postgres options are bigger hardware, shorter embeddings (512 dimensions store a third of the vector bytes of 1536; test recall on your own data before you commit), or partitioning by tenant. At 10M+ with no natural partition key, the dedicated-engine conversation is legitimate. At 100M, it is over. Go distributed.
The middle path: Postgres first, measure, then peel#
The boring strategy is the right one for most teams:
- Put embeddings next to the rows they describe. A
vector(1536)column, an HNSW index, ship it. If you want this without running the box yourself, managed pgvector is exactly this shape. - Measure with your data. Clustered real-world embeddings behave differently from the uniform random vectors in vendor benchmarks. We open-sourced pgvector-bench for this: it reports QPS at measured recall instead of QPS alone.
- Set exit criteria in advance. "p95 over 50 ms at recall 0.90," or "corpus passes the node's build ceiling." Decided calmly, before the incident.
- If you cross them, move only the vector workload. Postgres stays the source of truth; the vector engine becomes a derived, disposable index rebuilt from Postgres on demand. Sync becomes one-directional, reconciliation becomes "rebuild it," and roughly half the two-system tax disappears because the second system is a cache, not a peer.
What we would avoid is the inverse: starting with two systems "to be safe." You pay the sync tax from day one, before product-market fit, for scale you may never reach, and you cannot get that engineering time back.
What we would pick, scenario by scenario#
RAG over internal docs, multi-tenant SaaS, 50k to 500k chunks. Postgres, no hesitation. The tenant filter is a WHERE clause, deletes are transactional, and the whole thing fits a $49 to $85 node. If you are currently bumping the limits of a shared or pooled Postgres tier, a dedicated node fixes the ceiling without changing your architecture. Want to feel the latency yourself? ask.rivestack.io is semantic search over Hacker News running on a stock Postgres + pgvector node.
Product search, ~2M items, heavy faceted filtering. Borderline, and here is how we would resolve it: 2M at 1536 dims will not build on any of the nodes above, so it is either shorter embeddings (512d, for example) on a 16 GB node, partitioning by category, or Qdrant for the vectors with Postgres as source of truth. We would try shorter embeddings first, since it keeps you on one system, and measure the recall change on your own queries before deciding.
100M+ embeddings, pure semantic retrieval, no relational context. Dedicated engine from day one. Milvus or Qdrant if you have an infra team, Pinecone serverless if you do not. This is the workload those systems were built for, and forcing it into single-node Postgres is malpractice in the opposite direction.
Already on Pinecone with under 1M vectors, fighting metadata sync. This migration runs in the direction the marketing does not mention. The workload fits an $85 to $159 Postgres node, you get joins and transactional deletes back, and the sync pipeline gets deleted rather than maintained. The detailed comparison lives at /pinecone-alternative.
The pattern across all four: the dedicated engines win on a dimension (raw scale) that most products never reach, and Postgres wins on dimensions (correctness, simplicity, cost) that every product needs from day one. Choose for the workload you have, with an exit you have already designed.
Frequently asked questions#
Is pgvector good enough, or do I need a dedicated vector database?
For most applications pgvector is enough. In our tests a 16 GB node built and served 1M × 1536-dim vectors hot at ~3,600 QPS (recall@10 0.74, 16 clients), and smaller nodes handle 250k to 600k. You need a dedicated engine when your corpus is past what one node can build, when highly selective filters run over very large collections, or when you want a fully managed serverless service with no database to run.
Should I use pgvector or a native distributed vector database for production AI?
Use pgvector when your vectors fit on one node and your queries need relational data, permissions or transactional deletes, which is most production RAG and search. Use a distributed engine such as Milvus, Qdrant or Pinecone when you have tens to hundreds of millions of vectors, no natural partition key, and little relational context. If you are unsure, start on Postgres, set exit criteria, and move only the vector index if you cross them.
When should I use a separate vector database?
When you cross a measured limit: a corpus that will not build on your largest node, sustained throughput beyond one node, or heavily filtered search over hundreds of millions of vectors. Keep Postgres as the source of truth and treat the vector database as a derived index you can rebuild, so sync stays one-directional.
How many vectors can pgvector realistically handle on one node?
For hot HNSW serving at 1536 dimensions: roughly 350k on a 4 GB node, 600k on 8 GB, and 1M on 16 GB. The build ceilings are harsher than the serving ceilings: a 500k build on 4 GB took hours in our testing, and 1M fails outright on anything under 16 GB. Shorter embeddings shrink the vector data in proportion to the dimension cut. Past a few million vectors on the largest node you can buy, you are into partitioning or dedicated-engine territory.
What are pgvector's limitations at scale, and what are the alternatives?
The HNSW index is built and served on one node and the build is memory-bound, so 1536-dim indexes stop at around 1M vectors on 16 GB in our tests. Replicas are for failover by default, not extra read throughput. Inside Postgres the alternatives are shorter embeddings, the halfvec type, partitioning by tenant or category, and pgvectorscale's disk-based StreamingDiskANN index. Outside Postgres they are distributed engines such as Milvus, Qdrant and Pinecone.
How do PostgreSQL vector extensions compare with native vector databases on compression?
pgvector offers halfvec (2 bytes per dimension instead of 4), a bit type with binary_quantize() for binary vectors, and sparsevec, and pgvectorscale adds statistical binary quantization inside its StreamingDiskANN index. Native engines usually offer more: Qdrant has scalar, product and binary quantization with rescoring, and Milvus has quantized index types such as IVF_SQ8 and IVF_PQ. If memory is your binding constraint at very large scale, the native engines give you more knobs.
How do Postgres providers differ for vector search?
The main differences are the pgvector version (iterative index scans need 0.8 or later), whether pgvectorscale is available, storage (network-attached SSD vs local NVMe, which matters once an index outgrows RAM), RAM per dollar, and pooling (transaction pooling drops session-level SET, so use SET LOCAL). Metadata filters are plain SQL everywhere. Some platforms also add an auto-generated HTTP API (Supabase uses PostgREST), while others give you a standard Postgres connection; Rivestack gives you a connection string plus a hosted MCP server for AI agents.
What is the difference between a vector database and a relational database?
A vector database stores embeddings with a metadata payload and is built around approximate nearest-neighbor search. A relational database stores rows in tables with joins, constraints and transactions. Postgres with pgvector is both: embeddings are a column type, so nearest-neighbor search, filters and joins run in one SQL query against the same transactional data.
Is pgvector slower than Pinecone?
We have not benchmarked Pinecone, so we cannot give a head-to-head number. What we measured on an 8 vCPU/16 GB NVMe node: 1M 1536-dim vectors served at ~3,600 QPS with p50 4.2 ms at recall 0.74 (16 clients). At that size, hardware, network distance and ef_search settings matter as much as the engine. Dedicated engines pull ahead at tens of millions of vectors and on heavily filtered search at that scale. Whatever numbers you are shown, insist they come with recall and client count attached.
Should I use pgvector or OpenSearch?
Use OpenSearch if you already run it for full-text search and logs and want vectors in the same distributed search cluster; it has BM25 ranking built in and a k-NN plugin for vector search. Use pgvector if your source of truth is Postgres and results must respect relational data, permissions and transactions, since it avoids syncing a second store. We have not benchmarked OpenSearch, so this is a fit question, not a speed claim.
Can I add Postgres replicas to scale vector search reads?
Not automatically, and this catches people. In most managed HA configurations, including Rivestack's today, standby nodes exist for automatic failover, and the load balancer sends all queries, reads included, to the primary. Self-managed Postgres can serve reads from hot standbys if you build the routing and tolerate replication lag. Either way, do your capacity math against a single node.
Do I need a separate vector database for RAG?
Almost never. RAG retrieval is approximate nearest-neighbor search plus metadata filters plus a join back to source documents, exactly the shape Postgres handles in one query. The cases that justify a second system are a corpus past a few million chunks or sustained throughput beyond what one node delivers (~3,600 QPS at recall 0.74 with 16 clients on 16 GB-class hardware). Below that, the second system is mostly sync code and a bigger bill.
What is the biggest operational gotcha running pgvector in production?
PgBouncer transaction pooling silently discarding session-level settings. SET hnsw.ef_search = 100 over a transaction-pooled connection applies to one pooled session and vanishes; your queries quietly run at the default and recall drops with no error anywhere. Use SET LOCAL inside the query's transaction or ALTER DATABASE ... SET hnsw.ef_search to make it durable. The tuning guide covers this and the other parameters worth touching.
Keep reading