pgvector vs a Dedicated Vector Database
Most private search systems fit comfortably in Postgres with pgvector. This compares it with a dedicated vector engine on index types, metadata filtering, backups and the work of running a second database.

A company with 200,000 document chunks embedded at 1,024 dimensions needs about 820 MB to store them in Postgres with pgvector: the extension's own docs put each vector at 4 * dimensions + 8 bytes, so 4,104 bytes x 200,000 = 820.8 million bytes. That fits in the memory of an ordinary server several times over. For most businesses the pgvector vs vector database question ends there, and the honest answer is that the Postgres already backing the application is enough. A dedicated engine earns its keep in narrower places than vendor marketing suggests: filtered search under load, very large collections, and teams with the skills to run a second database properly.
The full retrieval pipeline around the store, from ingest to cited answer, is covered in private RAG over internal documents.
What each option actually is
pgvector is an extension for PostgreSQL. It adds a vector column type, distance operators (L2, inner product, cosine, L1, plus Hamming and Jaccard for binary vectors) and two approximate index types. Embeddings sit in a normal table next to the document ID, title, department and access list. A search is a SQL query with ORDER BY embedding <=> $1 LIMIT 10, and it can join against any other table in the database. Per its changelog the current release in October 2026 is 0.8.7, and it builds against Postgres 13 and later.
A dedicated vector database, such as Qdrant, is a separate server built around vector search. Each record is a vector plus a payload of metadata (JSON-like fields). It has its own API, its own storage format, its own clustering and its own backup mechanism. It does not join against your relational data; whatever metadata a filter needs has to be copied into the payload and kept in sync.
That last point is the hidden cost of the second system. A document whose permissions change in the main database has to be updated in two places, and the window between the two writes is a window where search returns something it should not.
Index types and what they trade
Exact search compares the query against every stored vector. pgvector does this with no index at all, and for small tables it is fine: 20,000 chunks at 1,024 dimensions is a scan of about 82 MB, which a modern CPU handles quickly. Past that, an approximate index trades a little recall (the share of the true nearest neighbors actually returned) for a large gain in speed.
HNSW
HNSW builds a layered graph of neighbors. The pgvector docs describe it as having a better speed-recall trade-off than IVFFlat, at the cost of slower builds and more memory. It has no training step, so it can be created on an empty table and grows as rows arrive. The defaults are m = 16 and ef_construction = 64 at build time, and hnsw.ef_search = 40 at query time. Raising ef_search improves recall and slows the query.
Builds are much faster when the graph fits in maintenance_work_mem, and Postgres prints a notice when it does not.
IVFFlat
IVFFlat clusters vectors into lists and searches only the nearest lists. It builds faster and uses less memory, but gives lower query performance for the same recall. It must be built after the table has data, because the clusters are learned from it. The docs suggest rows / 1000 lists up to a million rows and sqrt(rows) above that, and ivfflat.probes of about sqrt(lists) at query time. For 200,000 rows that is 200 lists and about 14 probes.
Dedicated engines mostly use HNSW too, so the algorithm is rarely the difference. Filtering is.
Filtering by metadata: where the real gap is
Almost every business search has a filter: this client's matters, this department's files, documents the asker may see. With an approximate index, pgvector applies the WHERE clause after the index scan, so a restrictive filter quietly returns fewer rows than the LIMIT asked for. The docs' worked example of this, and what it means for per-user permissions, is in the section on enforcing document permissions in private RAG. The question here is how each kind of store fixes it.
pgvector offers several fixes, and they cover most cases:
- Iterative index scans (added in 0.8.0). Setting
hnsw.iterative_scanorivfflat.iterative_scanmakes the scan keep going until enough rows pass the filter, bounded byhnsw.max_scan_tuples(default 20,000) orivfflat.max_probes. For HNSW,strict_orderkeeps exact distance order;relaxed_ordergives better recall with results slightly out of order, which a materialized CTE can re-sort. - Exact search for narrow filters. A B-tree index on the filter column plus no vector index lookup works well when the filter matches a small share of rows, because the planner scans only those rows.
- Partial indexes for a filter with a few distinct values, such as one HNSW index per document type.
- Partitioning for a filter with many values, such as one partition per client. The docs suggest list partitioning or separate tables for multitenant isolation.
Qdrant attacks the problem inside the index. Its docs describe extending the HNSW graph with extra edges based on indexed payload values, so the filter is applied while walking the graph. A query planner uses payload indexes to estimate how many points match and switches to a full scan of the candidates when the filter is strict.
The catch is ordering. Qdrant's docs say those extra edges can only be generated after a payload index exists, and recommend creating all payload indexes right after the collection is created. Adding one later means a resource-intensive rebuild.
For a system where filters are many, overlapping and change often, and where the collection is large enough that exact search on the filtered subset is slow, the dedicated engine's approach is a genuine advantage. For a system with a handful of departments, partitioning in Postgres gets most of the way.
Backups, recovery and day-two operations
pgvector writes through the Postgres write-ahead log, so the vectors get the same replication, point-in-time recovery and ACID guarantees as the rest of the data. The backup job that already protects the application database protects the embeddings. A restore brings back documents and their vectors in one consistent state.
A dedicated engine needs its own backup plan. In Qdrant, a snapshot is an archive of one collection on one node, and the docs state that in a cluster each node has to be snapshotted separately. Restores have a version rule: a snapshot can only go to a cluster on the same minor version or the next one. It is a second procedure to write and test.
Other routine work worth counting:
| Task | pgvector | Dedicated engine |
|---|---|---|
| Backup | Existing Postgres backup | Separate snapshot procedure |
| Access control | Postgres roles, row-level security | Engine's own API keys and auth |
| Keeping metadata in sync | Same table, one transaction | Application writes to two systems |
| Monitoring | Existing Postgres monitoring | New metrics, new alerts |
| Upgrades | Extension upgrade inside Postgres | Separate release cycle |
| Index maintenance | REINDEX then VACUUM for HNSW |
Engine-managed, often automatic |
pgvector has its own chores. The docs note that vacuuming an HNSW index can take a while and suggest REINDEX INDEX CONCURRENTLY first. Bulk loads should happen before the index is created. These are standard Postgres skills that whoever runs the database already has.
Scale: when the numbers start to matter
Storage arithmetic is the quickest sanity check. Using the pgvector figure of 4 * dimensions + 8 bytes:
- 200,000 chunks x 1,024 dimensions: about 0.8 GB
- 5 million chunks x 1,024 dimensions: 5,000,000 x 4,104 = about 20.5 GB
- Same 5 million as
halfvec(16-bit,2 * dimensions + 8bytes): about 10.3 GB
The index adds more on top, and HNSW search is fastest when the index stays in memory. A server with 64 GB of RAM holds the first two comfortably. Past tens of millions of vectors, pgvector still has tools, including binary quantization through an expression index with re-ranking against the original vectors, but this is where dedicated engines, built to shard a collection across nodes, start to look attractive.
Two limits are worth checking before choosing an embedding model. pgvector can index vector columns only up to 2,000 dimensions and halfvec up to 4,000. A model that outputs 3,072 dimensions needs halfvec or a reduced dimension to be indexed. The properties of candidate models are covered in choosing a local embedding model.
A decision rule
Start with pgvector when all of these hold:
- The application already uses Postgres, or the team knows it.
- The collection and its index fit the server's memory with room to spare. At 1,024 dimensions, ten million vectors is about 41 GB before the index, so this is a single-digit-millions rule on a typical server.
- Filters are few and stable: a department, a client, a document type.
- Permissions live in the relational database and must stay consistent with search.
Consider a dedicated engine when several of these hold:
- Collections run to tens or hundreds of millions of vectors, or need to span machines.
- Many overlapping metadata filters are combined per query, and filtered queries stay slow after iterative scans, partial indexes and partitioning have been tried.
- Search load is high enough to deserve its own hardware, isolated from transactional work.
- Someone on staff will own its backups, upgrades and monitoring.
The order matters. Moving from pgvector to a dedicated engine later is a data export and an application change, a bounded project. Running two databases from day one is a permanent cost. Measure retrieval quality first with a fixed question set, as described in how to evaluate a RAG system, and switch only when a measured problem points at the store rather than at chunking or the embedding model.
Frequently asked questions
Is pgvector fast enough for a chat assistant that searches company documents?
For collections in the hundreds of thousands to low millions of chunks, a vector search in pgvector is usually a small fraction of the total response time, because the language model's generation takes far longer. Time it on your own data with your own filters before assuming either way.
Can pgvector enforce per-user document permissions?
Yes, because the vectors live in ordinary tables. Postgres row-level security or a join against an access table can restrict results to what the asker may see, inside the same query. Check that the filtered query still returns enough rows, using iterative scans if needed.
Should vectors be stored as 32-bit or 16-bit?
The halfvec type halves storage and raises the indexable limit to 4,000 dimensions. For retrieval the precision loss is often small, but test recall on your own question set before converting a production table.
Ready to Modernize Your Business?
Get your AI automation roadmap in minutes, not months.
Analyze Your Workflows →