pgvector vs Dedicated Vector DBs: When Is Postgres Enough?

Every team that builds retrieval-augmented generation hits the same fork in the road: add a dedicated vector database, or keep embeddings in the Postgres instance already running in production?

If your embeddings live next to relational data and your corpus is in the thousands to low millions of vectors, Postgres with pgvector is almost always enough. You should reach for a dedicated store only when something specific breaks: scale, multi-tenancy, traffic spikes, or dimension limits that Postgres cannot clear.

Dedicated stores win the benchmark charts at billion-vector scale. pgvector’s edge is operational: it deletes a category of work. No second system to secure, back up, monitor, version, and keep consistent with the data it describes. For a small team, that avoided work is worth more than any QPS figure on a vendor landing page.

What pgvector actually is

pgvector is an open-source Postgres extension. It adds a vector column type, distance operators, and approximate-nearest-neighbor indexes to the database you probably already operate. You install the extension, add a column, build an index, and query it with SQL:

CREATE EXTENSION vector;

CREATE TABLE documents (
  id bigserial PRIMARY KEY,
  tenant_id uuid NOT NULL,
  content text,
  embedding vector(1536)
);

CREATE INDEX ON documents USING hnsw (embedding vector_cosine_ops);

SELECT id, content
FROM documents
WHERE tenant_id = '...'
ORDER BY embedding <=> '[0.1, 0.2, ...]'
LIMIT 10;

Three pieces matter for the comparison that follows.

First, the index types. pgvector ships IVFFlat (older, requires choosing list counts and rebuilding as data grows) and HNSW (newer, better recall at comparable speed, the default choice for new indexes). The vector type supports up to 2,000 dimensions; the halfvec type goes to 4,000 with half the storage per value.

Second, the operators. <-> is L2 distance, <=> is cosine distance, <#> is negative inner product. Distance is just another expression in a SQL query, which means filters, joins, and ordering compose the way they always do in Postgres.

Third, it is still Postgres. Transactions, row-level security, point-in-time recovery, and your existing backup story apply to the vectors too. There is no separate consistency model to reason about when an embedding and its source document must change together.

What dedicated vector databases do differently

Dedicated vector databases are purpose-built for one workload: approximate nearest-neighbor search at scale. The category splits three ways.

Managed services you rent. Pinecone is the archetype: you call an API, the vendor runs the infrastructure, and a serverless model separates storage from compute so you are not sizing clusters by hand. You trade operational control for someone else’s pager.

Open-source systems you run. Qdrant (written in Rust) and Milvus (distributed, built for very large corpora) fall here, both with managed cloud options. Weaviate sits in the same family and ships hybrid search, dense vector plus BM25 keyword search, as a built-in feature rather than something you assemble yourself.

Embedded libraries for prototyping. Chroma runs in-process and is fine for demos and local experiments. It is not where production workloads tend to land.

What these systems buy you: indexes engineered specifically for high query volume and very large corpora, disk-based and quantized index options that keep memory costs down at scale, first-class multi-tenancy primitives like namespaces, and turnkey hybrid search. What they cost you: a second data store with its own API, its own auth, its own backups, and a consistency boundary between your vectors and the relational data they describe.

The decision: five signals that actually matter

Forget feature matrices scraped from landing pages. In practice the choice comes down to five signals.

1. Do your vectors need to join relational data?

If your retrieval query looks like “find similar chunks, but only for this tenant, only for documents the user has permission to read, ordered by recency,” pgvector answers in one SQL statement. A dedicated store answers the vector part, and your application does the rest: fan out, filter, re-rank, merge. That application-side join is code you write, test, and maintain, plus a consistency gap between two systems.

If your workload is pure similarity search with minimal filtering, the dedicated store’s advantage shows. Most RAG pipelines are not pure similarity search.

2. How big is the corpus?

pgvector is comfortable in the thousands to low millions of vectors on a single Postgres instance, assuming the HNSW index fits in memory you can afford. Past that, into the hundreds of millions and billions, you are paying for RAM on a general-purpose database to hold an index that a purpose-built system stores more efficiently, including disk-resident options. That is the scale where a dedicated store starts to earn its keep.

Be honest about which side of that line you are on. Most teams building internal search, support copilots, or document Q&A never cross it.

3. What does your multi-tenancy look like?

A handful of tenants, or tenants that change rarely: pgvector handles this with a tenant_id column, partial indexes, or table partitioning. It is ordinary Postgres work.

Thousands of tenants created at signup, with strict per-tenant isolation as a compliance requirement: this is where dedicated stores pull ahead. Namespaces are a first-class primitive there, with isolation guarantees and per-tenant scaling behavior you would have to build yourself in Postgres.

4. What is your traffic shape, and who is on call?

Steady, predictable query volume on a team that already operates Postgres: pgvector adds no new operational surface. You already know how to back it up, monitor it, and scale the instance.

Spiky, unpredictable traffic, or a team with no database operations capacity: a serverless vector service absorbs bursts without you resizing anything, and the vendor owns vacuum, reindexing, and 3 a.m. pages. pgvector on self-managed Postgres means you own the index maintenance. That cost is real and often undercounted in “Postgres is free” math.

5. How many dimensions are your embeddings?

The vector type caps at 2,000 dimensions for HNSW indexes. The halfvec type extends that to 4,000 and halves storage, which covers the common embedding models (768, 1,024, 1,536, 3,072 dimensions all fit). If your pipeline produces vectors above 4,000 dimensions, or you expect model upgrades to push you there, dedicated stores handle high-dimensional vectors without this ceiling.

The third option nobody’s vendor will pitch

There is a middle path that rarely appears in comparison charts because no vendor is selling it: managed Postgres with pgvector. AWS RDS, Google Cloud SQL, Azure Database for PostgreSQL, Supabase, and Neon all support the extension. Google’s AlloyDB goes further and layers its own ScaNN-based index on top.

You keep the SQL, the joins, the transactions, and the single consistency model, and someone else owns the pager, the backups, and the index maintenance. For a large share of teams, this is the actual right answer. If your hesitation about pgvector is operational rather than architectural, managed Postgres answers it without adding a second data store.

If you start with pgvector and outgrow it

Starting with pgvector is not a trap. The retrieval logic in your application, chunking strategy, embedding model, and evaluation harness all transfer. What changes is the storage layer: you export vectors and metadata, load them into the new store, and swap the query call. The expensive parts of a RAG system are the pipeline and the evals, not the ORDER BY embedding <=> ... line.

The migration hurts most when you built application code around Postgres-specific behavior, like transactional writes that update a document and its embedding atomically, or row-level security policies that enforce tenant isolation. If you depend on those, the dedicated store needs its own answers, and those answers are work. Know which Postgres features your design actually relies on before you assume the move is mechanical.

FAQ

Is pgvector production-ready?
Yes. It is a mature open-source extension used in production by teams on self-hosted Postgres and on every major managed Postgres platform. The operational questions are the ordinary Postgres ones: sizing, index maintenance, and backups.

What is pgvector’s dimension limit?
The vector type supports up to 2,000 dimensions with HNSW indexes. The halfvec type supports up to 4,000 dimensions with roughly half the storage. Common embedding models (768 to 3,072 dimensions) fit within these limits.

Can pgvector do hybrid search?
Yes, by combining a vector similarity query with Postgres full-text search (tsvector/tsquery) in the same SQL statement, then fusing the rankings. Dedicated stores like Weaviate ship this as a turnkey feature; with pgvector you assemble it, but you control the ranking logic.

When should I switch from pgvector to a dedicated vector database?
When you hit a wall pgvector cannot clear at your scale: a corpus far beyond what fits your instance’s memory, thousands of dynamic tenants needing isolated namespaces, spiky traffic your team cannot absorb operationally, or embeddings above the dimension ceiling.

The default move is simple. If you already run Postgres, put the vectors in Postgres. Revisit the decision when your measurements tell you to, which for most teams is never.

Ditulis oleh

Firdaus Safari Putra

Founder, PT FirKaizen Digital Solutions

Firdaus Safari Putra adalah founder PT FirKaizen Digital Solutions. Ia membangun dan mengoperasikan infrastruktur server di balik panduan ini, dan menulis berdasarkan apa yang benar-benar ia jalankan, uji, dan ukur — bukan teori.