pgvector vs Pinecone: choosing a vector store
Engineering8 min read
Both store vectors and return nearest neighbours quickly. Benchmarks between them are widely quoted and rarely decisive, because for most applications the vector search is not the bottleneck and both are fast enough.
The decision usually turns on operational questions instead: how your data is joined, how tenant isolation is enforced, and how many systems you want to keep consistent. We chose pgvector for AskBrew and this explains the reasoning, including where it would have been the wrong call.
The actual difference
Pinecone is a managed vector database. You send vectors and metadata, it handles indexing, sharding, and scaling. It is purpose-built, and at very large scale that specialisation shows.
pgvector is a Postgres extension adding a vector column type and index support. Your embeddings live in a normal table, next to the rest of your data, queryable with normal SQL.
That last point is the whole argument. It is not about speed; it is about whether your vectors are a separate system or part of your database.
Why co-location matters more than benchmarks
Real queries are rarely pure similarity search. You want the nearest chunks belonging to this customer, from sources that are active, excluding anything archived — and then you want to join the results to source records to build citations.
With pgvector that is one query with a WHERE clause and a join, executed transactionally against consistent data. With a separate vector database it becomes: query the index with a metadata filter, get IDs back, then query Postgres for the rest, and handle the case where the two disagree because a delete has not propagated yet.
That inconsistency window is a real source of production bugs. A customer deletes a document, the row goes, the vector lingers, and the assistant cites something that no longer exists.
Tenant filter and similarity in one statement
select
c.id,
c.content,
c.metadata,
1 - (c.embedding <=> $query_embedding) as similarity
from chunks c
where c.workspace_id = $workspace_id
and c.embedding is not null
order by c.embedding <=> $query_embedding
limit $k;Tenant isolation is stronger in the database
For a multi-tenant product this is the strongest argument. In Postgres, the workspace filter is part of the query, and it can be backed by row-level security so the database refuses to return another tenant's rows even if application code forgets the filter.
With an external vector store, isolation is a metadata filter you must remember to apply on every call. It works. It is also one forgotten parameter away from serving one customer's documents to another — a failure with no good disclosure email.
AskBrew scopes retrieval inside a SQL function that takes the workspace ID as a required argument, so there is no code path that searches without one.
Index choice in pgvector
pgvector offers IVFFlat and HNSW. IVFFlat clusters vectors and searches the nearest clusters — smaller and faster to build, but it needs representative data before the clustering is meaningful, which makes it awkward for a system where tenants arrive continuously.
HNSW builds a navigable graph. Slower to build and larger on disk, better recall, and no dependency on having data present when the index is created. For a multi-tenant product where new workspaces appear constantly, that property decides it. We use HNSW with cosine distance.
HNSW, cosine
create index chunks_embedding_idx on chunks
using hnsw (embedding vector_cosine_ops);When Pinecone is the right answer
We would not pretend the choice is universal. Pinecone earns its place in several situations.
- Hundreds of millions of vectors, where a dedicated system's sharding is doing real work your Postgres instance is not built for
- Vector search is the product, not a feature of an application that also has relational data
- You are not already running Postgres, and adding it purely for this is the larger operational burden
- Your team would rather not own index tuning, vacuum behaviour, or the memory profile of a large HNSW index
The honest summary
If you already run Postgres and your vectors belong to tenants whose data also lives there, pgvector removes an entire system from your architecture and makes isolation enforceable by the database. If you are operating at a scale where that stops being true, you will know, and the migration is not the hard part.
We picked pgvector because AskBrew is a multi-tenant application that happens to do vector search, not a vector search product. Co-located data and database-enforced isolation were worth more to us than raw index throughput.
Try it on your own content
Free to start — live in minutes.
Keep reading
Engineering
API-based AI support: integrating an assistant into your own product
When a hosted widget does not fit — custom interfaces, mobile apps, existing helpdesks — and what an integration needs to get right.
Comparison
AskBrew vs Chatbase: which fits your support team?
Both build a chatbot from your own content. They differ in what happens when the assistant is unsure, and in whether it can answer questions about a specific customer's account.
Buyer's guide
Chatbase alternatives: how to actually choose one
A buyer's guide to the AI support chatbot category — the four questions that separate these tools, and which type of alternative fits which situation.
Buyer's guide
Best AI customer support software: a buyer's guide for 2026
What AI support tools actually do, the three categories they fall into, and how to evaluate them without relying on vendor feature tables.
Engineering
Multi-tenant RAG: keeping one customer's data out of another's answers
Vector search across shared infrastructure has a failure mode worse than a bad answer. How to make tenant isolation a property of the database rather than a discipline.
Engineering
Function calling for support bots
Letting an assistant look up a customer's order turns a content bot into something useful — and introduces an authorisation problem that must be solved outside the model.
Engineering
How to build an AI support agent
A build guide for the whole system: ingestion, retrieval, the answer gate, tool calls, and the operational pieces tutorials leave out.
Engineering
Preventing hallucinations in customer support bots
Grounding reduces fabrication but does not eliminate it. The techniques that actually work, and why an assistant that refuses is more valuable than one that always answers.
Engineering
RAG architecture explained, for people shipping it
The components of a retrieval-augmented generation system, the decisions that actually affect answer quality, and where production implementations diverge from tutorials.
Engineering
How AI customer support actually works
What happens between a customer typing a question and an answer appearing: retrieval, grounding, confidence, and the decision to answer or hand over.