pgvector vs LangSmith for production AI: Which Should You Use?
pgvector and LangSmith solve different problems, and treating them as substitutes is how teams waste time. pgvector is a vector search engine inside PostgreSQL; LangSmith is an observability and evaluation platform for LLM apps built around traces, datasets, and experiments. For production AI, use pgvector for retrieval and LangSmith for debugging/evaluation — if you force a choice, start with pgvector because it sits on the critical path.
Quick Comparison
| Area | pgvector | LangSmith |
|---|---|---|
| Learning curve | Low if you already know SQL and Postgres. You add the vector type, ivfflat or hnsw indexes, and query with <->, <=>, or <#> operators. | Moderate. You need tracing concepts, dataset management, runs, feedback, and evaluation workflows. |
| Performance | Strong for production retrieval when tuned correctly. Lives in Postgres, so latency is predictable and operationally simple. | Not a retrieval engine. It adds overhead for tracing and evals, not serving embeddings or ANN search. |
| Ecosystem | Excellent if your app already uses PostgreSQL. Works well with SQL filters, transactions, joins, and row-level access patterns. | Strong for LangChain/LangGraph users, but usable with any LLM stack via SDKs and tracing APIs. |
| Pricing | Open source extension; infra cost is your Postgres bill. No per-trace tax. | SaaS pricing applies for hosted usage; value comes from observability, evals, and team workflows. |
| Best use cases | Semantic search, RAG retrieval, deduplication, similarity matching inside transactional apps. | Prompt debugging, chain tracing, regression testing, dataset-driven evals, production monitoring. |
| Documentation | Straightforward Postgres-first docs: CREATE EXTENSION vector;, CREATE INDEX ... USING hnsw, SQL examples everywhere. | Good docs around tracing, datasets, evaluations, feedback, but more moving parts to adopt correctly. |
When pgvector Wins
- •
You need retrieval inside the same database as your app data.
- •Example: customer support RAG where tickets live in Postgres.
- •You can filter by tenant, region, status, or ACL in the same SQL query.
- •That matters more than fancy tooling.
- •
You want one operational surface area.
- •Postgres backups, replicas, migrations, permissions — all familiar.
- •No separate vector store to run.
- •No extra service just to support nearest-neighbor search.
- •
Your workload is production search over structured + unstructured data.
- •A common pattern:
SELECT id, content FROM documents WHERE tenant_id = $1 AND embedding <=> $2 < 0.25 ORDER BY embedding <=> $2 LIMIT 10; - •This is where
pgvectorshines: vector similarity plus normal relational filters.
- •A common pattern:
- •
You care about deterministic ops more than experimentation dashboards.
- •In banking or insurance systems, fewer moving parts usually wins.
- •
pgvectorgives you predictable failure modes and familiar Postgres tooling.
When LangSmith Wins
- •
You are debugging an LLM workflow that has too many invisible failure points.
- •Prompt changes break output format.
- •Tool calls fail intermittently.
- •Retrieval quality looks fine until the model answers nonsense.
- •LangSmith traces show each step end-to-end.
- •
You need proper evaluation before shipping prompt or chain changes.
- •Use datasets to store test cases.
- •Run experiments against prompt versions or chain variants.
- •Compare outputs with scores instead of guessing from a few manual tests.
- •
Your team needs production observability on LLM behavior.
- •Trace inputs, outputs, metadata, latency, token usage, errors.
- •Add feedback loops from users or reviewers.
- •This is how you catch regressions after deployment.
- •
You are building on LangChain or LangGraph and want native tooling.
- •LangSmith plugs directly into those ecosystems.
- •Tracing a chain graph is cleaner than stitching together logs yourself.
For production AI Specifically
Use pgvector when the problem is retrieval at runtime: semantic search over internal knowledge bases, product catalogs, case files, policies, claims notes. Use LangSmith when the problem is controlling model behavior: tracing failures, evaluating prompts, comparing runs, and proving that a change improved quality.
My recommendation: ship pgvector first if you need to serve users; add LangSmith immediately after if you need to keep the system stable. Retrieval without observability becomes guesswork fast; observability without solid retrieval just gives you prettier charts around a broken pipeline.
Keep learning
- •The complete AI Agents Roadmap — my full 8-step breakdown
- •Free: The AI Agent Starter Kit — PDF checklist + starter code
- •Work with me — I build AI for banks and insurance companies
By Cyprian Aarons, AI Consultant at Topiax.
Want the complete 8-step roadmap?
Grab the free AI Agent Starter Kit — architecture templates, compliance checklists, and a 7-email deep-dive course.
Get the Starter Kit