pgvector or a dedicated vector database
Use pgvector on PostgreSQL by default. It keeps embeddings transactionally consistent with source rows, removes an entire class of sync bug, and handles corpora into the millions of chunks with a tuned HNSW index. Move to a dedicated vector database when measured p95 search latency breaks your budget, or when write throughput and index rebuild time start affecting your primary database.
The argument for boring
Adding a vector database adds a second system of record. Your documents live in Postgres; their embeddings live somewhere else; and between them sits a synchronisation process that is now part of your correctness story.
That process fails in the worst possible way: silently, and in the direction of confident wrong answers. A document is deleted or corrected, the delete does not propagate, and the assistant cites a paragraph that no longer exists. Nothing errors. No dashboard turns red.
With pgvector, the chunk row and the vector update in the same transaction as the source. The failure mode disappears rather than being monitored.
What you should actually tune
Most disappointing pgvector benchmarks are untuned defaults. Three settings carry the outcome.
- Index type: HNSW over IVFFlat for most read-heavy RAG workloads - better recall at a given latency, at the cost of build time and memory
- hnsw.ef_search: the recall/latency dial at query time; raise it until recall plateaus, then stop
- Dimensionality: many embedding models support shortened outputs with minimal quality loss - halving dimensions roughly halves index size and speeds every search
- Filtering strategy: filter on indexed metadata columns alongside the vector search rather than over-fetching and filtering in application code
The signals that justify moving
Not corpus size on its own. Specific, measured symptoms.
Index rebuild time interfering with your maintenance window. Vector search competing for buffer cache with your transactional workload in a way you can see in query plans. p95 search latency exceeding budget after the tuning above. Write throughput that turns index maintenance into a bottleneck.
If none of those are true, moving to a dedicated store is adding an operational dependency to solve a problem you do not have.
The hybrid position
There is a middle option teams overlook: keep the source of truth and metadata in Postgres, and treat any external index as a derived, disposable cache that can be rebuilt from Postgres at any time.
That preserves the property that matters - one system owns the truth - while letting you use a specialised index for search. Rebuild is a script, not an incident.
Questions this raises
How large a corpus can pgvector handle?
With a tuned HNSW index and adequate memory, into the millions of chunks comfortably. The honest answer is that the limit depends on your latency budget, your filter selectivity, and your hardware, which is why the decision should come from a measurement on your corpus rather than a threshold from a blog post.
Does hybrid search work in Postgres?
Yes, and it is a strong argument for staying there. Full-text search and vector search live in the same database, so combining lexical and dense retrieval - and reranking the merged set - is a query rather than a distributed system.
What about embedding storage cost?
Dimensionality reduction is the lever most teams have not pulled. Many current embedding models support truncated outputs with small quality loss, which cuts storage and search cost proportionally. Measure recall at the shortened dimension before assuming you need the full vector.
Related
Retrieval recall is the RAG metric that actually decides quality
Most RAG systems fail at retrieval, not generation. How to measure recall@k on your own corpus, what a passing number looks like, and why prompt engineering cannot fix a retrieval problem.
INP is the hard Core Web Vital, and it is a JavaScript problem
Interaction to Next Paint is the metric most sites fail, and image compression will not fix it. Where the long tasks come from, how to break them up, and what an INP budget looks like in practice.
Production AI Systems
We design and ship production AI systems: retrieval-augmented generation on pgvector, deterministic multi-agent supervisors, evaluation harnesses, and guardrails. Built in Kolkata, deployed for teams across India, the US, the UK and the UAE.
Custom Software Engineering
Custom software engineering for teams that need sub-50ms responses, honest architecture, and code they can own. Next.js, Go, PostgreSQL and edge deployment, built by a software engineering studio in Kolkata, India.
Published 22 August 2026 · Last reviewed 22 August 2026 · Written by Manish Meena in Kolkata, India.
