Vector database selection is one of the most-discussed architectural decisions in AI app building. Most of the debate online is "which should I use?" rather than "here's what I built with it." This guide gives you a two-sentence recommendation first, then the evidence.
The Recommendation
Use pgvector if you already run Postgres and your vector count stays under ~1 million rows. Use Pinecone when you need sub-10ms ANN search at 10M+ vectors, multi-tenancy with namespace isolation, or managed filtering at scale.
The switching cost is low: pgvector embeddings are just a column you can export. Pinecone data requires re-indexing to migrate out.
pgvector performance degrades past ~1M rows without careful tuning. Pinecone is designed for the 10M+ range.
| Vectors | pgvector | Pinecone |
|---|---|---|
| < 100k | ✓ Excellent — exact KNN, no index needed | ✓ Works but overkill |
| 100k–1M | ✓ Good with HNSW index (HNSW recommended) | ✓ Good |
| 1M–10M | ⚠ Feasible with careful HNSW tuning | ✓ Designed for this range |
| > 10M | ✗ Significant degradation without pg sharding | ✓ Native serverless scaling |
HNSWRecommended Default
CREATE INDEX ON items USING hnsw (embedding vector_cosine_ops);
IVFFlatMemory-Constrained Use Only
CREATE INDEX ON items USING ivfflat (embedding vector_cosine_ops) WITH (lists = 100);
Both indexes support vector_cosine_ops, vector_l2_ops, and vector_ip_ops. Use cosine for normalized text embeddings (OpenAI, Cohere, etc.).
SQLAlchemy (Python)
from pgvector.sqlalchemy import Vector
from sqlalchemy import Column, Integer, Text
from sqlalchemy.orm import DeclarativeBase
class Item(Base):
__tablename__ = "items"
id = Column(Integer, primary_key=True)
content = Column(Text)
embedding = Column(Vector(1536)) # match your embedding dim
# Query nearest neighbors:
results = session.query(Item)
.order_by(Item.embedding.cosine_distance(query_vec))
.limit(5).all()Drizzle ORM (TypeScript / Supabase)
import { pgTable, serial, text, vector } from "drizzle-orm/pg-core";
export const items = pgTable("items", {
id: serial("id").primaryKey(),
content: text("content"),
embedding: vector("embedding", { dimensions: 1536 }),
});
// Query:
const results = await db.execute(sql`
SELECT *, embedding <=> ${queryVec}::vector AS distance
FROM items ORDER BY distance LIMIT 5
`);| Scale | pgvector (Supabase) | Pinecone |
|---|---|---|
| 100k vectors | Free (Supabase free tier) | Free (1 index) |
| 1M vectors | ~$25/mo (Supabase Pro) | ~$70/mo (Starter) |
| 10M vectors | ~$100/mo (larger Postgres) | ~$350/mo (Standard) |
| 100M vectors | Requires sharding / Citus | Custom Enterprise pricing |
Estimates only — pricing varies by region, compute tier, and query volume. Always check current provider pricing pages.
HookFlow's current momentum ranking for the vector DB ecosystem.
Open-source vector similarity search extension for PostgreSQL. Adds vector storage and ANN search directly to your existing Postgres database — no separate vector DB required.
View on HookFlow34
heat
A managed vector database purpose-built for AI — stores and retrieves embeddings at sub-100ms latency, making it the standard infrastructure layer for AI memory and search.
View on HookFlow28
heat
Build with Supabase, the open-source Firebase alternative offering AI vector search, real-time databases, and authentication for developers worldwide.
View on HookFlow63
heat
Use cosine distance (<=> operator) for normalized text embeddings from OpenAI, Cohere, or other embedding APIs. Use L2 (<-> Euclidean) for image embeddings or when your embedding model explicitly recommends it. Inner product (<#>) is an optimization when embeddings are unit-normalized (same result as cosine, faster computation).
Yes — pgvector is enabled by default on all Supabase projects (including the free tier). Supabase's dashboard has a dedicated vector search UI and their vecs Python library wraps pgvector with a clean API. The Supabase JavaScript client supports raw SQL for vector queries.
Yes, with a workaround: combine a vector similarity search with a full-text search (Postgres tsvector/tsquery) using a reciprocal rank fusion (RRF) query. It's more complex than Pinecone's native hybrid search but achievable in pure SQL. Supabase has documentation on this pattern.
HookFlow ranks pgvector, Pinecone, and every vector DB by community momentum, downloads, and trend signals — updated daily.
View pgvector Heat Score →Practical LangChain agent debugging guide: LangSmith tracing, StdOut callbacks, common failure modes, and when to switch to LangGraph or the raw SDK.
Ollama, Axolotl, Unsloth, Haystack, and Burn are co-moving — a rare multi-tool signal. This guide shows how to wire them into a complete run-fine-tune-serve pipeline you own.
Learn how to run AI models locally on your own hardware — completely offline, private, and free. Step-by-step guide covering the best local AI tools including Jan and Open WebUI.