Databases

Pinecone Introduces pg_pinecone: Open-Source Vector Search for PostgreSQL

Many AI apps need to find the most relevant rows inside PostgreSQL. Pinecone's new open-source extension, pg_pinecone, aims to make that search faster, smaller, and more accurate—without moving your data out of Postgres.

Pinecone pg_pinecone open-source vector search extension for PostgreSQL
pg_pinecone adds Pinecone-style vector search to PostgreSQL as an open-source extension.

Pinecone has released pg_pinecone, an open-source PostgreSQL extension under the Apache 2.0 license. An extension is an add-on that teaches Postgres new skills. In this case, the skill is vector search: finding records by meaning, not only by exact words.

The company says many AI products—support helpers, recommendation engines, and agents that remember past work—depend on data that already lives in Postgres. As tables grow, common graph-style indexes can become heavy on memory, slow to build, and weaker when a query is filtered to one user or tenant. pg_pinecone is built to keep search inside the database you already run.

What is vector search, in simple words?

Computers can turn text, images, or other content into a list of numbers called an embedding or vector. Similar ideas get similar number lists. Vector search looks for the closest lists—so a support bot can find the right help article even when the user does not type the exact title.

Many Postgres teams already store those vectors with pgvector. pg_pinecone is designed to work with those same vector columns. Your app can keep connecting to Postgres the usual way and keep writing SQL such as ordering by distance and taking the top matches.

Plain picture: Postgres keeps the full rows. pg_pinecone builds a search helper on top of the vector column so nearest-neighbor lookups stay fast as the table grows.

How pg_pinecone works

Each table can use one of three engines. Switching engines is done with a SQL call such as pinecone.set_engine(), and Pinecone says your queries do not need to change.

  1. native (default)Runs pg_pinecone's own engine fully inside Postgres. No Pinecone account, API key, or network calls are required for this mode.
  2. pgvectorUses pgvector's HNSW index if that is what you already run.
  3. remoteSends search to an index in Pinecone's managed service when you want to scale beyond one server.

The native engine still uses approximate nearest neighbor (ANN) search—meaning it finds very close matches quickly rather than checking every row in a huge table. Instead of a graph index that stores full vectors plus neighbor links, it groups similar vectors into clusters and stores a compressed summary of each vector.

A smaller index

Pinecone says the native index stores quantized vector codes with a method called RaBitQ—roughly about one bit per dimension, plus a few correction values. The codes for each cluster sit packed together, so a search can read a few nearby pages instead of hopping around a large graph in memory.

In the company's published comparison on 1 million vectors with 768 dimensions, the native engine built a 136 MB index, versus about 2.0 GB for HNSW on halfvec and about 4.1 GB on full-size vectors.

Faster search

A native search does most of its work with cheap comparisons, then finishes with a shortlist:

  • Find the nearest clusters by comparing the query with each cluster's center point (centroid).
  • Estimate distance from each row's compact RaBitQ code and keep the best candidates.
  • Rerank those candidates with the full vectors still stored in your table.

At 0.95 recall on the same 1M × 768 setup, Pinecone reports about 1.3 ms median latency for the native engine, compared with about 1.7 ms for HNSW on halfvec and about 2.7 ms on full-size vectors. At 0.99 recall, the reported times are about 2.3 ms versus 4.7 ms and 6.7 ms.

More accurate filtered results

Real apps often add a WHERE clause—for example, one tenant, one user, or one category. Graph indexes that filter after finding neighbors can drop many candidates and return fewer rows than the requested limit. The native engine filters during the search and picks a strategy based on how selective the filter is.

  • Narrow filter (about 3% of rows or fewer, by default): pre-filtering. It scans matching rows across clusters and scores them with full vectors for exact results.
  • Wider filter (more than about 3%): single-stage filtering inside more nearby clusters before scoring.

In one reported hard case where 10% of rows match, the native engine reached 1.000 recall in about 12.3 ms, while HNSW with iterative scans reached about 0.920 recall at best in about 5.9 ms.

Keeping the index current

New inserts join the nearest cluster and become searchable right away. After very large changes—such as a bulk load that doubles the table—Pinecone recommends running REINDEX or enabling automatic maintenance so clusters stay balanced.

What the benchmarks highlight

Pinecone compared the native engine with pgvector HNSW on the same wiki_dpr-style data: 1 million 768-dimension vectors on an AWS r6id.4xlarge (16 vCPUs, 128 GB RAM). Across those tests, the company highlights four themes:

  • Faster unfiltered search at the same recall.
  • More accurate filtered search, especially when the filter is narrow.
  • Faster index builds, so large tables become searchable sooner.
  • Much smaller indexes that are easier to keep in memory—including under a 4 GB memory cap test.

Exact numbers can change with hardware, data shape, and settings. Teams should rerun the public benchmark harness on their own workload before making architecture bets.

Optional extras when you need more scale

The native engine can cover many apps on its own. With a Pinecone API key, the same extension can add optional features one at a time. Your SQL queries can stay the same, and Postgres remains the source of truth.

Remote engine for bigger growth

When an index grows large enough to compete with the rest of the database for memory, you can move search to Pinecone with a command like SELECT pinecone.set_engine('docs', 'remote');. Embeddings sync in the background. Searches keep running in Postgres until the copy finishes, and you can switch back the same way.

Create embeddings in SQL

If a table has text but no vectors yet, pinecone.embed() can call Pinecone's inference service and fill the column. Pinecone says its free tier can cover a first build, which helps teams start from text without hosting their own embedding model.

Keyword search and reranking

Teams can also track text columns for Pinecone full-text search (BM25) beside vector search—useful when users look for exact product names or error codes as well as meaning. A rerank() helper can reorder top results so the most relevant passages rise first, which matters for RAG-style apps that only need the best few chunks.

Remember: native search can run with no Pinecone account. Remote search, hosted embeddings, full-text sync, and rerank are optional add-ons that need Pinecone connectivity.

How to try pg_pinecone

Official setup guides live in the pg_pinecone overview and install guide. The project also ships from the pg_pinecone GitHub repository and the pineconeteam/pg_pinecone Docker image. It targets PostgreSQL 17 and 18 with pgvector installed.

  1. Install the extensionUse a prebuilt release, Docker, or another supported install path from the docs.
  2. Create or reuse a vector columnKeep an existing pgvector column, or create one and optionally fill it with embed().
  3. Build the indexEnable the extensions, then call pinecone.create_index(...), optionally naming a filter column such as tenant_id.
  4. Query with normal SQLFilter and order by embedding distance the way you already do in Postgres.

Pinecone says this is a first release and is collecting roadmap ideas through GitHub, Discord, and monthly office hours. Bug reports and feature requests are welcome on the public repository.

What It Means for Developers

pg_pinecone matters because many AI features are really database features: find the right rows fast, respect tenant filters, and avoid running a second search system too early. Here is how that can change day-to-day work.

What It Means for Backend Developers

Backend engineers who already store embeddings in Postgres can try a new index path without redesigning tables. The same distance operators and LIMIT patterns stay in play, while filtered multi-tenant queries may become more trustworthy.

  • Prototype semantic search inside the database before adding a separate vector service.
  • Design schemas with a clear filter column when tenants or users must never see each other's hits.
  • Plan for REINDEX or maintenance after large bulk loads, just as you would for other heavy indexes.
  • If you ship APIs with Node.js or Express, keep using normal SQL clients—the extension work happens in Postgres, not in a new client library.

What It Means for Full-Stack Developers

Full-stack builders often stitch chat UIs to a retrieval step for RAG. pg_pinecone can keep that retrieval next to the product data, users, and permissions already in Postgres.

  • Start with the native engine for local demos and small production apps.
  • Use optional embed() and rerank() when you want fewer moving parts early on.
  • Keep an eye on when remote search becomes useful so growth does not force a full rewrite of app SQL.
  • Compare this Postgres-first path with document-store AI tooling such as the MongoDB tutorial when choosing where application data should live.

What It Means for DevOps Engineers

Operators care about memory, build time, extension installs, and a clean path from laptop to server. A smaller index that stays resident can reduce pressure on the same machine that serves transactions.

  • Evaluate the official Docker image for local and CI environments.
  • Confirm PostgreSQL 17/18, superuser install rights, and pgvector prerequisites before rollout.
  • Watch shared memory and maintenance jobs as vector tables grow.
  • Treat the remote engine as an escape hatch when one Postgres host can no longer hold the search workload alone.
  • If you deploy databases on cloud VMs, hardening guides such as AWS security groups still matter for who can reach Postgres.

What It Means for Software Developers

For product teams building AI features, the practical win is simplicity: one database for business rows and nearest-neighbor search, with a later option to push search outward without changing query shapes.

  • Reduce early microservice sprawl when search volume is still modest.
  • Write clearer acceptance tests around filtered recall, not only happy-path unfiltered demos.
  • Read the public docs and operator notes before promising production SLAs on a first release.

What to watch next

A few checkpoints will decide how useful pg_pinecone becomes for each team:

  1. Your own filtered benchmarksRerun tests with your tenant filters, dimensions, and hardware before replacing HNSW everywhere.
  2. Maintenance habitsDecide when automatic maintenance or REINDEX should run after bulk updates.
  3. Roadmap feedbackFirst releases change quickly; GitHub requests and Discord notes will shape the next features.

Bottom line

Pinecone's pg_pinecone brings open-source vector search into PostgreSQL for teams that already keep embeddings beside their product data. The native engine focuses on a compact index, quicker builds, and filters applied during search, while optional remote search, embeddings, keyword search, and reranking are available when you need them.

For developers, the appeal is practical: keep familiar SQL, keep Postgres as the source of truth, and add a search engine that can start local and grow later—without inventing a second data home on day one.

CODETOFUN NEWS

Stay Ahead in Tech

Get the latest IT news, programming updates, and technology trends directly on your phone.

Your daily dose of tech, straight to your feed.

About the author