· 11 min read
pgvector, Pinecone and Qdrant on the same workload
We ran one production workload on three vector databases and compared latency, recall, cost and how much work each one was to operate.
Why we compared them
Choosing a vector database feels like a reversible decision. In practice, switching means re-indexing millions of embeddings, rewriting query logic and changing infrastructure. At MiraiTech we have run all three in production on different projects, and the right choice depends on the project's constraints.
The three options
pgvector is a PostgreSQL extension that adds vector similarity search to your existing Postgres database. It is the "no new infrastructure" option.
Pinecone is a fully managed vector database service. You get an API and a dashboard, and there is nothing to operate.
Qdrant is an open-source vector search engine written in Rust. You can self-host it or use their managed cloud.
Benchmark results
We benchmarked all three on the same workload: 1 million vectors at 1536 dimensions (the output size of OpenAI text-embedding-3-small), on comparable hardware.
| Metric | pgvector (HNSW) | Pinecone (s1) | Qdrant (self-hosted) |
|---|---|---|---|
| Index build time | 47 min | N/A (managed) | 12 min |
| Query latency P50 | 8ms | 22ms | 4ms |
| Query latency P99 | 45ms | 89ms | 18ms |
| Recall@10 (ef=128) | 0.97 | 0.98 | 0.99 |
| Memory usage | 4.2 GB | N/A | 3.1 GB |
| Throughput (QPS) | 850 | 400 | 2,200 |
| Filtered query P50 | 15ms | 28ms | 6ms |
pgvector: when your database is enough
Setting up pgvector
-- Enable the extension
CREATE EXTENSION IF NOT EXISTS vector;
-- Create a table with a vector column
CREATE TABLE documents (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
content TEXT NOT NULL,
embedding vector(1536),
metadata JSONB DEFAULT '{}',
created_at TIMESTAMPTZ DEFAULT now()
);
-- HNSW index — this is where the magic happens
CREATE INDEX ON documents
USING hnsw (embedding vector_cosine_ops)
WITH (m = 16, ef_construction = 200);
-- Composite index for filtered queries
CREATE INDEX ON documents (created_at);
CREATE INDEX ON documents USING gin (metadata jsonb_path_ops);
-- Query with metadata filtering
SELECT id, content, 1 - (embedding <=> $1::vector) AS similarity
FROM documents
WHERE metadata @> '{"category": "engineering"}'
AND created_at > now() - INTERVAL '30 days'
ORDER BY embedding <=> $1::vector
LIMIT 10;What pgvector does well
pgvector's main advantage is no new infrastructure. If you already run Postgres, and you probably do, you can add vector search without taking on another database with its own backups, monitoring and failure modes. Your vectors live next to your relational data, so joins are trivial and transactional consistency is free.
Where pgvector struggles
pgvector starts to strain above 5-10 million vectors on a single instance. HNSW index builds are slow and use a lot of memory. There is no built-in sharding, so if you outgrow a single machine, you are on your own with Citus or manual partitioning.
Pinecone: the managed option
Setting up Pinecone
from pinecone import Pinecone, ServerlessSpec
pc = Pinecone(api_key="your-api-key")
# Create a serverless index
pc.create_index(
name="documents",
dimension=1536,
metric="cosine",
spec=ServerlessSpec(cloud="aws", region="us-east-1"),
)
index = pc.Index("documents")
# Upsert vectors with metadata
index.upsert(
vectors=[
{
"id": "doc-001",
"values": embedding,
"metadata": {
"category": "engineering",
"author": "miraitech-team",
"word_count": 1500,
},
}
],
namespace="blog-posts",
)
# Query with metadata filtering
results = index.query(
vector=query_embedding,
top_k=10,
filter={
"category": {"$eq": "engineering"},
"word_count": {"$gte": 500},
},
include_metadata=True,
namespace="blog-posts",
)What Pinecone does well
Pinecone needs no operations work: no capacity planning, index tuning or infrastructure management. The serverless offering scales automatically and you pay per query. For a team without dedicated infrastructure engineers, that matters a lot.
Namespaces work well for multi-tenancy: each customer's vectors are isolated without separate indexes.
Where Pinecone struggles
Cost grows faster than with the alternatives. At 10 million vectors with moderate query volume, we paid roughly 4x what an equivalent self-hosted Qdrant setup cost. Every query is an HTTP round-trip, so network latency is unavoidable. Lock-in is also a concern: there is no standard migration format between vector databases.
Qdrant: the fastest in our tests
What Qdrant does well
Qdrant had the best raw performance in our benchmarks. Its Rust implementation and HNSW optimizations give it the highest throughput of the three. Filtering is its strongest feature: filters run during the HNSW traversal instead of after the query, so filtered queries are nearly as fast as unfiltered ones.
The API is well designed, with good support for batch operations, named vectors (multiple vector types per point) and payload indexing.
Where Qdrant struggles
Self-hosting means the operational work is yours: backups, monitoring, scaling and upgrades. Their managed cloud helps with this, but it is newer and less proven than Pinecone's. The documentation is improving but has gaps in advanced clustering configurations.
Cost at 5 million vectors
Cost often decides it. These are our numbers at 5 million vectors with moderate query loads (roughly 100 QPS on average).
| Cost component | pgvector | Pinecone Serverless | Qdrant (self-hosted) | Qdrant Cloud |
|---|---|---|---|---|
| Compute/hosting | $0 (existing DB)* | Included | ~$200/mo (dedicated) | ~$150/mo |
| Storage | ~$10/mo | ~$75/mo | ~$15/mo | ~$40/mo |
| Query costs | $0 | ~$120/mo at 100 QPS | $0 | Included |
| Operational overhead | Low | None | Medium-high | Low |
| Estimated monthly total | ~$10 | ~$195 | ~$215 | ~$190 |
*pgvector's compute cost is effectively zero if your Postgres instance has headroom. If the vector workload forces an instance upgrade, add that cost.
How we choose
After deploying all three, these are our rules:
Choose pgvector when:
- You have fewer than 5 million vectors
- Your queries always combine vector search with relational filters
- You want no additional infrastructure
- Latency under 50ms is acceptable
Choose Pinecone when:
- Your team has no dedicated infrastructure capacity
- You need multi-tenant isolation (namespaces)
- You are willing to pay more for operational simplicity
- You need to scale past 10 million vectors without planning
Choose Qdrant when:
- Raw query performance matters most
- You have the engineering capacity for self-hosting (or use their cloud)
- You need advanced features like named vectors or complex filtering
- Cost at scale is a primary concern
Migrating between them
When you do need to migrate (we have done it twice), this is the process:
- Dual-write first. Write new vectors to both old and new systems. Do not try a big-bang migration.
- Backfill in batches. Re-embed and insert historical data in chunks of 10,000. Rate-limit to avoid overwhelming either system.
- Shadow-read. Query both systems and compare results. Log discrepancies. We ran shadow reads for two weeks before cutting over.
- Gradual cutover. Route 10% of read traffic to the new system, then 50%, then 100%. Monitor recall and latency at each stage.
- Decommission after a soak period. Keep the old system running for 30 days after full cutover, just in case.
What we use today
For most projects we start with pgvector. It removes a whole category of operational complexity, and for datasets under a few million vectors with moderate query loads it performs well. We migrate a project to Qdrant once there is a clear signal that it has outgrown pgvector. A hunch about future scale does not count.
We use Pinecone for client projects where the client's team will run operations after handoff and does not have infrastructure expertise. In those cases the managed service is worth the premium.
Written by the MiraiTech team in Tokyo
If something here is wrong, or you are working on a similar problem, write to us at contact@mirai-tech.net.