pgContext is a PostgreSQL extension that embeds a full AI search engine—dense vector search, metadata-filtered ANN, and hybrid dense+full-text retrieval—directly into Postgres, eliminating the need for separate vector databases.

Stars

131

7-day growth

No data

Forks

8

Open issues

0

License

Apache-2.0

Last updated

2026-07-25

Why it is worth attention

It delivers 3.8–5.3× faster HNSW search than pgvector at equal recall on standard benchmarks, while keeping all data under PostgreSQL's MVCC, ACL, RLS, and backup boundaries, and provides built-in hybrid retrieval with reciprocal-rank fusion.

Who it is for

  • PostgreSQL users who need high-performance vector search without leaving their existing database
  • AI/ML developers seeking a single-stack solution for semantic and keyword search
  • Platform engineers wanting to reduce operational complexity by avoiding separate vector services
  • Teams migrating from pgvector or dedicated vector databases to a more integrated approach

Use cases

  • Hybrid semantic + keyword search over large document collections (e.g., Wikipedia-scale datasets)
  • Filtered product or content search with multi‑condition metadata constraints (must/should/must_not)
  • In‑database AI retrieval for RAG pipelines where data sovereignty and ACL enforcement are critical
  • Real‑time recommendation or similarity lookup with exact re‑scoring under MVCC visibility

Strengths

  • 3.8–5.3× faster ANN queries than pgvector at matching recall on the GloVe‑100‑angular benchmark
  • Filter‑aware HNSW that maintains recall even under selective metadata filters without requiring a separate filter index
  • Hybrid retrieval (dense + full‑text) built into the extension, not as external glue
  • Every ANN candidate is exactly re‑scored against the live row, respecting PostgreSQL MVCC, RLS, and ACL

Considerations

  • Early‑stage extension (v0.1.0/v0.2.0) with limited PostgreSQL version support (17 & 18 only) and no pgvector name‑compatibility
  • IVFFlat index not yet implemented; x86 performance claims are not measured in the current release
  • Building from source requires Rust 1.96.0 and cargo‑pgrx 0.19.1, which may increase setup complexity for some teams

README quick start

pgContext

A full AI search engine, built into Postgres.

Hybrid dense + full-text retrieval, filter-aware ANN, and exact, MVCC-visible re-scoring: a dedicated vector engine's feature set, as a PostgreSQL 17 extension.

Built by Evokoa  ·  Fully-managed hosting at Polygres

pgContext is an Apache-2.0 PostgreSQL 17 and 18 extension that turns Postgres into a full AI search engine: dense vector search, metadata-filtered approximate search, and hybrid (dense + full-text) retrieval, all inside the database you already run.

Most retrieval stacks add a second service, copy your application data into it, and create a separate authorization, backup, and recovery boundary to keep in sync. pgContext keeps retrieval next to the data it searches: your ordinary PostgreSQL tables stay the source of truth for vectors, metadata, MVCC, ACL/RLS, backup, and replication. HNSW and other acceleration state are derived, rebuildable indexes (never a second copy that can drift), and every approximate result is re-scored exactly against the live row before it is returned, so a fast answer is still a correct, permission-safe answer.

At a glance: exact and persisted HNSW search · L2, inner-product, cosine, and L1 metrics · filters over registered columns and JSONB paths · MVCC/ACL/RLS and exact-score rechecks · collections, scroll, count, facets, and grouping · dense + full-text hybrid retrieval with reciprocal-rank fusion.

[!TIP] Looking for a managed version? We have launched a managed version of pgContext on polygres.com for full high performance AI Retrieval on Postgres.

Live demos

See pgContext's retrieval in action (hosted on Polygres):

  • Wikipedia hybrid search: query a Wikipedia-scale dataset with live semantic + keyword hybrid retrieval.
  • Memory demo: an interactive hybrid-retrieval playground with adjustable fusion weights across retrieval channels.

Vector search

Standard GloVe-100-angular benchmark (1.18M vectors, cosine), both engines in one PostgreSQL 17 container with the same parallel build budget, scored against the dataset's own ground-truth nei

Description

A full AI search engine, built into Postgres.

Related repositories

Similar projects matched by category, topics, and programming language.

Blaizzy
Featured
Blaizzy GitHub avatar

nativ

Nativ is a native macOS app that lets you run AI models locally on Apple silicon, offering chat, model management, performance analytics, and an OpenAI/Anthropic-compatible API server.

AI & Machine LearningAI Agents
890
RongleCat
Featured
RongleCat GitHub avatar

grok-app

Grok App is a desktop command center built with Tauri 2 that wraps the local Grok Build CLI into a graphical workbench for managing sessions, projects, media, automations, and accounts.

AI & Machine LearningAI Agents
266
ogulcancelik
Featured
ogulcancelik GitHub avatar

herdr

herdr is a terminal-based agent multiplexer that lets you monitor, manage, and interact with multiple AI agents in a single terminal session, with detachable sessions, a socket API for agents, and a plugin system.

AI & Machine LearningDeveloper Tools
20,632