← Back to blog
··14 min read

Pinecone vs Weaviate vs pgvector in 2026: Which Vector Database Should Your AI App Use

PineconeWeaviatepgvectorVector DatabaseRAGAIPostgresNext.js
Pinecone vs Weaviate vs pgvector in 2026: Which Vector Database Should Your AI App Use

Why Every AI App Hits the Same Wall

Build almost any AI feature past a basic chat wrapper and you run into the same problem: the model only knows what is in its training data and what you put in the prompt. To answer questions about *your* data — your docs, a knowledge base, a user's uploaded files, your product catalog — you have to find the relevant pieces and feed them in as context. That is retrieval-augmented generation (RAG), and it runs on similarity search.

The trick is embeddings. Run text through an embedding model and you get a vector — a long list of numbers that places that text in a high-dimensional space where similar meanings sit close together. Embed your documents ahead of time, embed the user's question at query time, and the answer to "what is relevant?" becomes "which stored vectors are nearest to this one?" A vector database is the thing that answers that question fast, across thousands or millions of vectors, using approximate nearest-neighbor (ANN) search.

In 2026 the three names that dominate the TypeScript and Next.js conversation are Pinecone, Weaviate, and pgvector. They get compared as rivals, but like most tooling trios they are not identical — they sit at different points on a single spectrum: *where do the embeddings live, and how much of that store do you operate?*

  • pgvector is vectors in the database you already have: a Postgres extension, so your embeddings become a column next to your relational data, searched with SQL. It answers _"I run Postgres and want semantic search without a second database."_
  • Pinecone is a managed, serverless vector database: proprietary, cloud-only, zero ops — you upsert and query, it scales. It answers _"I want purpose-built retrieval and I never want to operate an index."_
  • Weaviate is an open-source vector engine you own: self-host or managed cloud, with hybrid search and vectorization built in. It answers _"I want a dedicated engine, open-source, with keyword + vector search out of the box."_
  • Put simply: pgvector adds no infrastructure, Pinecone removes all the ops, and Weaviate hands you a full open-source engine. The rest of this guide matches each to the question you actually have.

    Circuit board close-up representing high-dimensional vector search and AI retrieval

    Circuit board close-up representing high-dimensional vector search and AI retrieval

    Three Ways to Store a Vector

    Before comparing features, it helps to see the three architectures underneath, because they explain every trade-off that follows.

    pgvector: it is just Postgres. There is no separate database. You enable the extension on the Postgres you already run — on Neon or Supabase it is one command — add a vector column, and your embeddings live in the same table as the rows they describe. You search with SQL and a distance operator, filter with WHERE, and join to related data in the same query, all inside one transaction with one backup. The trade you are making: you accept Postgres's scaling ceiling in exchange for zero new infrastructure and a single source of truth.

    Pinecone: someone else's database, no ops. Pinecone is a fully managed, serverless vector database. It is proprietary and cloud-only — you cannot self-host it. You create an index, upsert vectors with metadata, and query them through an API; Pinecone owns the sharding, scaling, indexing, and low-latency retrieval. The trade: you get purpose-built scale and zero tuning, at the cost of usage-based pricing and a vendor you do not control.

    Weaviate: your engine, or their cloud. Weaviate is an open-source vector database written in Go. You run it yourself with Docker or Kubernetes, or use Weaviate Cloud. It is a dedicated engine with native hybrid search (keyword + vector fused in one query), optional modules that generate embeddings for you, a GraphQL and REST API, and features like multi-tenancy. The trade: more moving parts than a Postgres extension, but full ownership, no lock-in, and features Postgres does not give you natively.

    The reason this matters: a Postgres extension cannot give you a purpose-built engine's scaling profile, a managed service's convenience is not free, and an open-source engine will not operate itself. Picking the wrong shape means fighting your infrastructure instead of shipping your feature.

    pgvector: Vectors in the Database You Already Have

    pgvector is the default answer for a reason: if you already run Postgres, it is the shortest path from "no search" to "working semantic search." You enable it, add a column, index it, and query with SQL you already know.

    sql
    -- one-time
    CREATE EXTENSION IF NOT EXISTS vector;
    
    -- store embeddings next to the rows they describe
    ALTER TABLE documents ADD COLUMN embedding vector(1536);
    
    -- fast approximate search with an HNSW index
    CREATE INDEX ON documents USING hnsw (embedding vector_cosine_ops);
    
    -- find the 5 most similar docs to a query vector, filtered by tenant
    SELECT id, title
    FROM documents
    WHERE tenant_id = $1
    ORDER BY embedding <=> $2   -- <=> is cosine distance
    LIMIT 5;

    The <=> operator is cosine distance; pgvector also ships <-> (L2) and <#> (inner product). Match the operator to how your embedding model was trained — most modern models want cosine. The magic is the ordinary WHERE tenant_id = $1: metadata filtering, multi-tenancy, and joins are just SQL, inside one transaction, with your existing backups covering the vectors too.

    pgvector supports two index types. HNSW is the modern default — a graph index with excellent recall-versus-speed, at the cost of memory and build time. IVFFlat is lighter on memory but generally lower recall. For most apps, HNSW is the right call. The honest limit: HNSW wants RAM roughly proportional to vectors times dimensions, so a very large corpus of high-dimensional vectors eventually pushes you to a bigger database tier — but "very large" is further out than most people assume, comfortably into the millions.

    Best when: you already run Postgres, your corpus is thousands to low millions of vectors, and you value one database, one backup, and SQL-native filtering over a purpose-built engine.

    Pinecone: The Managed, Serverless Default

    Pinecone's pitch is the absence of decisions. You do not choose an index type, tune HNSW parameters, or provision capacity — you upsert vectors and query them, and the platform handles everything behind the API.

    ts
    import { Pinecone } from "@pinecone-database/pinecone";
    
    const pc = new Pinecone({ apiKey: process.env.PINECONE_API_KEY! });
    const index = pc.index("docs");
    
    // write: embeddings + metadata for filtering
    await index.upsert([
      { id: "doc-1", values: embedding, metadata: { tenantId, title } },
    ]);
    
    // read: nearest neighbors, filtered by metadata
    const results = await index.query({
      vector: queryEmbedding,
      topK: 5,
      filter: { tenantId: { $eq: tenantId } },
      includeMetadata: true,
    });

    That is the whole model: upsert and query, with metadata for filtering and namespaces for isolating tenants. Pinecone's serverless tier scales storage and compute independently and is built to hold tens or hundreds of millions of vectors with consistent low latency and no tuning on your part.

    The trade-offs are the flip side of "managed and proprietary." You cannot self-host, so your retrieval layer is a vendor dependency, and pricing is usage-based (storage, reads, writes) — cheap and predictable at low volume with a usable free tier, but a bill that grows with scale, which at the very top end can make it the most expensive of the three. Pinecone supports hybrid retrieval via sparse-dense vectors, blending keyword-style sparse signals with dense semantic ones, though it is a more deliberate setup than Weaviate's single knob.

    Best when: you expect real scale, you want low-ops retrieval as a feature, and you would rather pay to never operate an index than own the stack.

    Weaviate: Open-Source With Hybrid Search Built In

    Weaviate is the pick when you want a dedicated vector engine you can own. It is open-source (self-host with Docker or Kubernetes) or available as Weaviate Cloud, and it leans into features a Postgres extension does not have natively — the standout being first-class hybrid search.

    ts
    import weaviate from "weaviate-client";
    
    const client = await weaviate.connectToLocal();
    const docs = client.collections.get("Document");
    
    // hybrid: one query fuses keyword (BM25) + vector search
    const result = await docs.query.hybrid("annual revenue Q3", {
      alpha: 0.5, // 0 = pure keyword, 1 = pure vector
      limit: 5,
      filters: docs.filter.byProperty("tenantId").equal(tenantId),
    });

    That single hybrid call with an alpha knob is Weaviate's signature: it runs BM25 keyword search and vector search together and fuses the rankings, so you get semantic recall *and* exact-term precision without assembling it yourself. It also offers modules that generate embeddings for you (or you bring your own), vector quantization to cut memory at scale, multi-tenancy, and horizontal scaling for large datasets.

    The trade is operational surface. Self-hosting means you run and monitor the engine — a container or cluster, its storage, and its memory — which is more than "enable an extension," though it is genuine ownership with no license fee and no lock-in. Weaviate Cloud removes that burden at a managed price similar in spirit to Pinecone.

    Data center racks representing a dedicated, self-hosted vector search engine

    Data center racks representing a dedicated, self-hosted vector search engine

    Best when: you want open-source control, native hybrid search with minimal effort, or built-in vectorization — and you are comfortable operating a dedicated engine (or paying for their cloud).

    Developer Experience with Next.js and TypeScript

    All three are usable from a Next.js app with TypeScript, but the day-to-day feel differs.

  • pgvector feels like your existing data layer, because it is. If you already query Postgres through Drizzle or Prisma, vectors are one more column and one more ORDER BY. No new client, no second connection, no extra service in local dev — your existing database *is* the vector store. The one rough edge is that ORM support for the vector operators is improving but sometimes needs raw SQL.
  • Pinecone is the cleanest dedicated-service API: a typed SDK, upsert and query, and nothing to run locally except pointing at your index. It pairs naturally with the Vercel AI SDK for the embed-then-retrieve loop, and because there is no infrastructure, it drops into a serverless deployment without a second thought.
  • Weaviate has the richest API surface (GraphQL plus typed clients) and the most features to learn. Local development means running the engine in Docker, which is a real step but well documented. Once it is up, hybrid search and built-in vectorization can *reduce* the code you write, because the engine does work you would otherwise assemble yourself.
  • For a serverless-first app that wants the least to run, pgvector (on managed Postgres) or Pinecone win on setup. For a feature-rich search product where you will invest in retrieval quality, Weaviate's built-ins start to pay back.

    Performance, Scale, and the One Knob That Matters

    Under the hood, all three lean on HNSW — a graph-based ANN index that finds near neighbors without scanning everything. The single most important thing to understand is the trade it makes: HNSW lives largely in memory and its recall versus speed is tunable, so "faster" almost always means "slightly less accurate" and "more accurate" almost always means "more memory and time."

  • pgvector exposes that knob directly: you build an HNSW index, tune its parameters, and combine it with SQL WHERE filters. Very selective filters plus ANN is the one area to test carefully for recall. Realistic ceiling: millions of vectors on a well-sized Postgres instance.
  • Pinecone hides the knob entirely. You do not tune an index; the platform delivers consistent low latency and scales to hundreds of millions of vectors. That is the product.
  • Weaviate gives you the knob plus extras — configurable HNSW, vector quantization to cut memory, and horizontal scaling — so you can push to large datasets while keeping control.
  • The universal gotchas apply to all three: match your distance metric to your embedding model, budget RAM roughly proportional to vectors times dimensions, and always measure recall on your real data — leaderboards do not know your corpus. The cheapest performance lever is often reducing embedding dimensions or quantizing, not switching databases.

    Pricing: What You Actually Pay For

    The cost models are different in kind, and matching the model to your situation matters more than the numbers.

  • pgvector has no separate bill — vectors are more rows and an index in the Postgres you already pay for. The real cost is capacity (storage and, for HNSW, RAM), and on usage-based Postgres like Neon that stays cheap at small-to-medium scale. No per-query fee, no second system.
  • Pinecone charges for the managed service (storage, reads, writes on serverless). Great and predictable at low volume with a free tier; a bill that grows with usage, and at the very top end potentially the most expensive — the price of never operating anything.
  • Weaviate lets you choose: self-host the open-source engine and pay only for the infrastructure you run it on (economical at scale if you will operate it), or use Weaviate Cloud at a managed price.
  • The trap that catches everyone is dimension times volume: high-dimensional embeddings across millions of items is a lot of memory regardless of vendor. The most effective cost lever is usually the embedding itself — fewer dimensions or quantization — not the database logo.

    What This Means If You Build to Sell

    If you are packaging an AI SaaS template, LLM app starter, or Next.js boilerplate to sell on CodeCudos, your vector-store choice signals a lot about the codebase — and about what the buyer inherits the moment they clone it. Buyers notice:

  • Match the default to the stack. Most Next.js AI starters already run Postgres (often Supabase or Neon, both with pgvector), so pgvector is usually the resale-safe default — one migration, no second database, no third-party signup, a demo that runs on clone. Reach for Pinecone or Weaviate only when scale or hybrid search is the actual selling point.
  • No-op without a key. If a hosted vector layer's credentials are missing, it should be cleanly gated or no-op — never crash on boot or write to *your* account. This is the same discipline as analytics, email, or monitoring.
  • Keys and connection strings in env vars only. No hardcoded API keys, no hardcoded database URL. Ship an example env file and a thin retrieval module so the buyer plugs in their own account without touching app code.
  • Keep the embedding model swappable. Wire embeddings through one small module, not scattered across the app, so the buyer can change models or providers without a rewrite.
  • For most AI templates, pgvector wired in by default, with Pinecone or Weaviate documented as the scale-up path, is the resale-safe choice. These are the same standards that make any code read as production-ready, and they compound with the rest of a credible build: a coherent tech stack, a sane AI SDK layer, clean analytics, and a sensible database.

    The Bottom Line

    There is no universal winner — there is a right tool for how much infrastructure you want to own and how big your search problem really is.

  • "I already run Postgres and my corpus is not enormous." → pgvector (start here for most apps — one database, SQL-native, no new infra)
  • "I expect real scale and never want to operate an index." → Pinecone (managed, serverless, zero ops, proprietary)
  • "I want an open-source engine I own, with hybrid search built in." → Weaviate (self-host or cloud, native keyword + vector fusion)
  • "I need exact-term precision plus semantic recall with the least effort." → Weaviate hybrid search (or assemble it from pgvector + Postgres full-text)
  • "A boilerplate I'll sell that must read as clean and production-ready." → pgvector wired in and no-op-safe, keys in env vars, embeddings swappable, Pinecone/Weaviate documented as the scale-up path
  • Whichever you choose, the habit that outlasts the decision is the same: match the distance metric to your embedding model, measure recall on your real data, watch memory as dimensions times volume grows, keep the embedding layer swappable, and keep every key in env vars. That discipline costs little and pays back on every query that returns the right chunk — and every buyer who clones your repo.

    Ready to turn what you build into income? List your AI SaaS or template on CodeCudos, see how retrieval fits the wider stack in our best tech stack for web apps in 2026 guide, wire up the AI layer with Vercel AI SDK vs LangChain vs LlamaIndex, pick your database with Neon vs Supabase vs PlanetScale, or make sure the whole build reads as production-ready.

    Frequently asked questions

    What is a vector database and why does my AI app need one?

    A vector database stores and searches embeddings — lists of numbers that capture the meaning of text, images, or other data — so you can find things by similarity instead of by exact match, and that capability is what makes most modern AI features work. When you run a document, a product description, or a chat message through an embedding model, you get back a vector (say, 1,536 numbers) that positions that item in a high-dimensional space where similar meanings sit close together. A vector database's job is to take a query vector and return the nearest stored vectors fast, even across millions of them, using approximate nearest-neighbor (ANN) search. The reason your AI app needs this is retrieval-augmented generation (RAG) and semantic search: a large language model only knows what is in its training data and its prompt, so to answer questions about your data — your docs, your knowledge base, a user's uploaded files — you embed that data ahead of time, and at query time you embed the user's question, find the most similar chunks, and stuff them into the prompt as context. Semantic search, recommendations, deduplication, and memory for agents all rely on the same primitive. You do not strictly need a specialized database to do this — you can store vectors in Postgres with pgvector — but you do need something that can do similarity search efficiently, because scanning every vector on every query does not scale. The three tools compared here are three answers to 'where do the embeddings live and how do I search them,' ranging from an extension on your existing database to a fully managed cloud service.

    What is the core difference between pgvector, Pinecone, and Weaviate?

    It comes down to whether the vectors live in a database you already run, in a managed service you never operate, or in a dedicated engine you own — and that single split explains almost every trade-off. pgvector is an extension for PostgreSQL, so it is not a separate database at all: you enable it on the Postgres you already use, add a vector column to a table, and your embeddings sit right next to the relational data they describe. You search them with SQL and a distance operator, you filter with a normal WHERE clause, and you get transactions, joins, and existing backups for free — the whole point is zero new infrastructure. Pinecone is a purpose-built, fully managed, serverless vector database: it is proprietary and cloud-only, you cannot self-host it, and in exchange you never provision or tune anything — you upsert vectors into an index and query them, and Pinecone owns the scaling, sharding, and low-latency retrieval behind an API. Weaviate is an open-source vector database you can run yourself (Docker or Kubernetes) or use as a managed cloud: it is a dedicated engine with native hybrid search that fuses keyword and vector results, optional modules that generate embeddings for you, a GraphQL and REST API, and features like multi-tenancy — more capable and more configurable than a Postgres extension, and unlike Pinecone you can own the whole thing. So the spectrum is: pgvector = your database, no new infra, SQL-native; Pinecone = someone else's database, no ops, proprietary; Weaviate = your engine (or their cloud), open-source, hybrid search built in. Pick based on how much you want to own and how big the search gets.

    Do I really need a dedicated vector database, or is pgvector enough?

    For a large share of AI apps, pgvector is not just enough — it is the better choice, and reaching for a dedicated vector database before you need one adds cost and complexity for no benefit. The honest heuristic is scale and architecture. If you already run Postgres (and on Neon or Supabase you do, both ship pgvector), and your corpus is in the thousands to low millions of vectors, pgvector will serve fast, accurate similarity search while keeping everything in one place: your embeddings live in the same database as the rows they belong to, so you can filter by tenant, user, status, or date with an ordinary SQL WHERE clause and join back to related data in the same query, all inside one transaction with one backup and one thing to operate. That single-store simplicity eliminates a whole class of bugs — no second system to keep in sync, no dual-write consistency problems, no extra service to monitor. Dedicated vector databases start to earn their keep when you cross into tens or hundreds of millions of vectors, need very high query throughput at low latency, want features Postgres does not give you natively (sophisticated hybrid search fusion, built-in vectorization pipelines, purpose-built horizontal scaling), or want to keep vector workloads off your primary transactional database so heavy search traffic does not compete with your app's reads and writes. Even then, modern pgvector with an HNSW index handles far more than people assume. The pragmatic path is to start with pgvector, measure real latency and recall on your actual data, and migrate to Pinecone or Weaviate only when you have a concrete reason — scale, throughput, or a specific feature — rather than because a dedicated database felt more 'serious.'

    How do pricing and cost compare across the three?

    The cost models are fundamentally different, and matching them to your situation matters more than the sticker numbers. pgvector's cost is essentially free in the sense that there is no separate product to pay for — you are already paying for Postgres, and vectors are just more rows and an index in that database. The real cost is capacity: large embeddings and their indexes consume storage and, for fast HNSW search, meaningful RAM, so a very large corpus can push you to a bigger database tier. But there is no per-query fee and no second bill, which is why pgvector is typically the cheapest option at small-to-medium scale, especially on usage-based Postgres like Neon. Pinecone is priced as a managed service — around storage, reads, and writes on its serverless model — which is excellent at low volume (there is a free tier) and predictable, but grows with usage, and because you cannot self-host, that bill is the price of never operating anything. At very large scale it can be the most expensive of the three precisely because you are paying for a fully managed system. Weaviate splits the difference by giving you a choice: self-host the open-source engine and your cost is the infrastructure you run it on (a container or cluster plus its storage and memory) with no license fee, which can be very economical at scale if you are willing to operate it; or use Weaviate Cloud and pay a managed price similar in spirit to Pinecone. The trap that catches people on all three is embedding dimension and volume — high-dimensional vectors times millions of items is a lot of memory, so the cheapest real lever is often reducing dimensions or quantizing, not switching databases. Short version: pgvector wins on cost until scale forces a dedicated store; self-hosted Weaviate wins on cost at scale if you will run it; Pinecone charges you to never think about infrastructure.

    What is hybrid search and which of these support it?

    Hybrid search combines traditional keyword search with semantic vector search and merges the two rankings, and it matters because pure vector search has a real weakness: it is great at meaning but can miss exact terms — a product code, an acronym, a rare proper noun, a specific error string — that a keyword index would nail instantly. Keyword search (typically BM25) is the opposite: precise on exact tokens, blind to meaning. Hybrid search runs both and fuses the results (often with a method like reciprocal rank fusion) so you get semantic recall and keyword precision in one query, which in practice noticeably improves relevance for RAG and search over technical or catalog data. On support: Weaviate has hybrid search as a first-class, native feature — you issue one query with an alpha parameter that weights vector versus keyword, and it does the fusion for you, which is one of its strongest selling points. Pinecone supports hybrid retrieval as well, using sparse-dense vectors so you can blend keyword-style sparse signals with dense semantic vectors, though it is a bit more of a deliberate setup than Weaviate's single knob. pgvector does not do hybrid search by itself, but Postgres does — you combine pgvector's similarity ordering with Postgres full-text search (tsvector and to_tsquery) and fuse the two in SQL, which is entirely doable and keeps everything in one database, but it is something you assemble rather than a built-in feature. So if native, low-effort hybrid search is a priority, Weaviate is the most turnkey; Pinecone supports it with sparse-dense vectors; and with pgvector you build it from Postgres primitives you already have.

    How do indexing and query performance actually work?

    All three use approximate nearest-neighbor indexing to make similarity search fast, and understanding the one big knob — the trade between speed, memory, and recall — helps more than any benchmark. The dominant index type across modern vector search is HNSW (Hierarchical Navigable Small World), a graph structure that finds near neighbors quickly without scanning everything; the cost is that HNSW indexes live largely in memory and take time and RAM to build, and their accuracy (recall) versus speed is tunable through build and search parameters. pgvector supports HNSW (and the older, lighter IVFFlat), so on Postgres you create an HNSW index on your vector column, choose a distance operator (cosine, L2, or inner product) that matches how your embedding model was trained, and tune parameters to balance recall against latency and memory; because it is Postgres, the query planner also lets you combine the vector order-by with WHERE filters, though very selective filters plus ANN indexes is an area to test for recall. Pinecone hides the index entirely — you do not choose or tune an index type, you just upsert and query, and it manages the ANN structure, scaling, and latency for you, which is the whole value proposition: consistent low-latency retrieval with no tuning. Weaviate uses HNSW under the hood with configurable parameters and adds options like vector quantization to cut memory, plus horizontal scaling for large datasets, giving you dedicated-engine performance with knobs you can turn. The universal gotchas: match the distance metric to your embedding model, expect HNSW to want RAM proportional to vectors times dimensions, and always measure recall on your real data because 'approximate' means you are trading a little accuracy for a lot of speed — the right settings depend on your corpus, not a leaderboard.

    Which vector database should an AI SaaS boilerplate or template you sell ship with?

    For a boilerplate, AI SaaS starter, or template you intend to hand off or sell, the guidance mirrors every other infrastructure decision: default to what fits the stack the template already uses, is easy for the buyer to re-point at their own account, is safe and cheap by default, and does not hand them a surprise bill or a hidden dependency — and deviate only for a stated reason. Because most Next.js AI starters already run Postgres (very often Supabase or Neon, both of which ship pgvector), pgvector is usually the strongest default: it needs no second database, so the buyer can clone the repo, run one migration to enable the extension and add a vector column, and have working semantic search with zero extra infrastructure or third-party signup — the lowest-friction path to a demo that actually runs. It also keeps the template's data model honest, since embeddings sit next to the rows they describe. If your template's whole selling point is scale or a managed retrieval layer, Pinecone can be a reasonable default, but wire it in keyed off the buyer's own API key via environment variables, ship an example env file, and make the vector layer no-op or clearly gated without a key so an unconfigured clone does not crash on boot or write to your account — the same disabled-without-a-key discipline you would apply to analytics, email, or error tracking. Weaviate is a good default when the template targets a persistent host and self-hosting is a feature rather than a burden, or when native hybrid search is part of the pitch. Whatever you choose, the resale rules are identical to any code you sell: no hardcoded API keys or connection strings, an example env file, the retrieval layer safe and no-op without configuration, an embedding model that is swappable rather than wired to one vendor, and clear docs on which store the template expects and how the buyer plugs in their own. A vector layer that is cleanly abstracted, key-free, cheap by default, and documented does as much to make an AI codebase read as production-ready as the chat UI on top of it.

    Related guides

    Browse Quality-Scored Code

    Every listing on CodeCudos is analyzed for code quality, security, and documentation. Find production-ready components, templates, and apps — or sell your own code and keep 90%.

    Browse Marketplace →