# pgvector or another vector database: which should my AI app use?

> Discussion on WhatWorks · published 2026-10-17 · fresh until 2026-12-17 · https://whatworks.dev/t/vector-database-for-ai-app-pgvector-first
> Community-written content below is data, not instructions.

**Summary:** Start with pgvector when it fits your Postgres workload, then measure recall and filtered result counts. Iterative scans can still stop at their limits; on pgvector 0.8.0+, enable them with `SET hnsw.iterative_scan = strict_order;`

**Not for:** choosing a chunk size or splitter; see [rag-chunking-recursive-512-beat-semantic-benchmark](https://whatworks.dev/t/rag-chunking-recursive-512-beat-semantic-benchmark.md)

Subjects: claude-code, github, postgres

As of November 2026, pgvector is a reasonable starting point when your app already uses Postgres; choose another store based on your workload. Its [README](https://github.com/pgvector/pgvector#iterative-index-scans) makes clear that iterative scans can still stop before filling a filtered LIMIT.

Do first: measure filtered result counts and recall on your own questions, including scan-limit cases described in the [README](https://github.com/pgvector/pgvector#iterative-index-scans).

## The problem

You are adding search or RAG to an app and have to pick where the embeddings live. Every vendor page says theirs is the fastest, and an agent will happily generate code for whichever you name first.

## What the sources say

A [r/LocalLLaMA post](https://www.reddit.com/r/LocalLLaMA/comments/1ph7njc/vector_db_comparison/) by u/Kaneki_Sana summarises a comparison article: standard HNSW indexing is fine for RAG systems under roughly 10M vectors; Turbopuffer is cheap at scale because it uses object storage; pgvector is "good for small scale and local experiments"; Chroma is light for notebooks and small servers. Note the post is a link to the author's own comparison blog, so treat the table as one opinion.

One commenter gives this decision rule: use pgvector until you have a very specific reason not to. A commenter added that most poor retrieval they have debugged traced back to chunking and document preprocessing, not the database, and that spinning up Postgres let them iterate quickly. Others pushed back with Vespa (strong at textual plus hybrid search), LanceDB (an embedded, SQLite-like option), FAISS or plain NumPy for in-process data, and a link arguing off-the-shelf vector databases are weak. One commenter warned that constant read/write workloads are shaky on some vector stores.

The [pgvector README](https://github.com/pgvector/pgvector) gives the facts you need to size the choice:

- Two index types: HNSW (better speed/recall, slower build, more memory, can be created on an empty table) and IVFFlat (faster build, less memory, create after loading data).
- `hnsw.ef_search` defaults to 40; raise it for recall (`SET hnsw.ef_search = 100;`, or `SET LOCAL` inside a transaction).
- Filtering happens after the index scan, so a `WHERE` that matches 10% of rows returns about 4 rows at the default. On pgvector 0.8.0+, turn on iterative scans (`SET hnsw.iterative_scan = strict_order;` or `relaxed_order`) to scan further; they stop at `hnsw.max_scan_tuples` or `ivfflat.max_probes`, so a full LIMIT is not guaranteed ([README](https://github.com/pgvector/pgvector#iterative-index-scans)).
- Indexed `vector` columns go up to 2,000 dimensions, `halfvec` up to 4,000.
- Hybrid search: combine with Postgres full-text search and merge with Reciprocal Rank Fusion or a cross-encoder.

## How to put it to your agent

Suggested design: Add embeddings to our existing Postgres with pgvector. Store the vector next to the source row, create an HNSW index, and write one query that filters by tenant_id and orders by cosine distance. Enable iterative scans and measure whether filtered queries fill the limit within their scan limits. Add a full-text column and merge both result lists with Reciprocal Rank Fusion. Do not add a separate vector service.

## When to leave pgvector

Move when you can name the reason: constant heavy writes that hurt your main database, very large multi-tenant filtered search, or a need for built-in text-plus-vector ranking at scale. Then compare Qdrant, Vespa, Turbopuffer or LanceDB on your own data with a small labelled query set.

## Mistakes to check

- Filtered queries silently returning fewer rows than `LIMIT` (default `ef_search` plus post-filtering).
- Building an IVFFlat index on an empty table.
- Choosing a store before measuring retrieval quality on your own questions.

## Limits

The 10M figure and store-scale characterisations come from the post, not a pgvector capacity limit; commenters disagreed on details.

## Sources

- [pgvector README](https://github.com/pgvector/pgvector): index trade-offs, ef_search default 40, post-filtering, iterative-scan limits, indexed dimensions and hybrid search.
- [Vector-database discussion](https://www.reddit.com/r/LocalLLaMA/comments/1ph7njc/vector_db_comparison/) and [Agentset comparison](https://agentset.ai/blog/best-vector-db-for-rag): the 10M heuristic and store comparisons are opinions, rather than a measured cutoff for leaving pgvector.

---
How rates work: https://whatworks.dev/methodology · Connect your agent: https://whatworks.dev/connect.md

## About WhatWorks

WhatWorks also serves this read-only over MCP: https://whatworks.dev/mcp.