gitwtfhub

wtf is pgcontext?

evokoa/pgcontext — explained in plain English

Analysis updated 2026-05-18

82RustAudience · developerComplexity · 4/5LicenseSetup · moderate

TL;DR

A Postgres extension, written in Rust, that turns your database into an AI search engine with vector, hybrid, and filtered retrieval, no separate search service needed.

Mindmap

mindmap
  root((repo))
    What it does
      Vector search in Postgres
      Hybrid dense plus text search
      Metadata filters
    Tech stack
      Rust
      PostgreSQL 17 and 18
      HNSW indexes
    Use cases
      Search existing database tables
      Wikipedia-scale hybrid search
      AI memory with fusion weights
    Audience
      Developers using Postgres
      Teams avoiding separate search
    Performance
      Faster than pgvector
      High recall at low latency
      Exact re-scoring

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Why would anyone build with this?

REASON 1

Add AI-powered vector and hybrid search directly to an existing Postgres database without a separate service.

REASON 2

Run metadata-filtered approximate search over database rows with must, should, and must_not conditions.

REASON 3

Build a Wikipedia-scale hybrid search demo combining dense vectors with full-text ranking.

REASON 4

Replace pgvector with a faster extension while matching recall on standard benchmarks.

What's in the stack?

RustPostgreSQLHNSW

How it stacks up

evokoa/pgcontextanvia-hq/lexal0ng-ai/tty7
Stars828381
LanguageRustRustRust
Setup difficultymoderateeasyeasy
Complexity4/52/52/5
Audiencedeveloperdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you spin it up?

Difficulty · moderate Time to first run · 30min

Requires PostgreSQL 17 or 18 and installing a Rust-built extension into your Postgres instance.

Use freely for any purpose, including commercial use, as long as you keep the copyright notice and state any changes.

Wtf does this do

pgContext is a PostgreSQL extension, written in Rust, that turns the database into a full AI search engine. Instead of running a separate search service alongside your database and copying your data into it, pgContext keeps the search inside Postgres. Your existing tables remain the single source of truth for vectors, metadata, permissions, backups, and replication. The extension covers dense vector search using HNSW indexes, metadata-filtered approximate search, and hybrid retrieval that combines vector search with PostgreSQL's full-text ranking. It supports several distance metrics: L2, inner-product, cosine, and L1. Filters can be applied over registered columns and JSONB paths using a style similar to Qdrant, with must, should, and must_not conditions, plus range and equality checks. Results go through exact re-scoring against live rows before being returned, so approximate matches are verified under PostgreSQL's transaction visibility and row-level security rules. On the standard GloVe benchmark with 1.18 million vectors, pgContext matches pgvector's recall at every search setting while answering queries 3.8 to 5.3 times faster. At roughly 2.5 milliseconds per query, pgContext reaches 0.91 recall where pgvector reaches 0.75. The extension also ships with hybrid retrieval built in, fusing dense vector results with full-text ranking using reciprocal-rank fusion, rather than leaving that as application-level glue. The project is Apache-2.0 licensed and targets PostgreSQL 17 and 18. It is built by a company called Evokoa, which also offers a managed hosting version through a service called Polygres. Two live demos are available: a Wikipedia-scale hybrid search and an interactive memory demo with adjustable fusion weights. The README includes benchmark comparisons against pgvector and Qdrant, along with links to full reports and documentation. The full README is longer than what was shown.

Yoink these prompts

Prompt 1
I have a Postgres database with a table of articles, each with a text column and an embedding vector column. Show me how to install and use pgContext to run hybrid search that combines vector similarity with full-text ranking.
Prompt 2
Help me set up pgContext metadata filters using must, should, and must_not conditions over a JSONB column in my Postgres table, similar to Qdrant's filter style.
Prompt 3
I'm currently using pgvector for approximate nearest neighbor search in Postgres. Walk me through migrating to pgContext and benchmark query speed and recall against my existing setup.
Prompt 4
Show me how to configure pgContext HNSW indexes with cosine distance and run a filtered vector search that respects Postgres row-level security.

Frequently asked questions

wtf is pgcontext?

A Postgres extension, written in Rust, that turns your database into an AI search engine with vector, hybrid, and filtered retrieval, no separate search service needed.

What language is pgcontext written in?

Mainly Rust. The stack also includes Rust, PostgreSQL, HNSW.

What license does pgcontext use?

Use freely for any purpose, including commercial use, as long as you keep the copyright notice and state any changes.

How hard is pgcontext to set up?

Setup difficulty is rated moderate, with roughly 30min to a first successful run.

Who is pgcontext for?

Mainly developer.

View the repo → Decode another repo

This repo across BitVibe Labs

Don't trust strangers blindly. Verify against the repo.