pgContext 是一个 PostgreSQL 扩展,它将完整的 AI 搜索引擎(包括稠密向量搜索、支持元数据过滤的近似最近邻搜索以及稠密与全文混合检索)直接嵌入 Postgres,无需额外部署单独的向量数据库。

Stars

131

7 天增长

暂无数据

Fork 数

8

开放 Issue

0

开源协议

Apache-2.0

最近更新

2026-07-25

为什么值得关注

在标准基准测试中,pgContext 的 HNSW 搜索在相同召回率下比 pgvector 快 3.8–5.3 倍,同时将所有数据保留在 PostgreSQL 的 MVCC、ACL、RLS 和备份边界内,并提供内置的混合检索(倒数排序融合)。

适合谁使用

  • 需要高性能向量搜索但不想离开现有 Postgres 数据库的 PostgreSQL 用户
  • 寻求统一解决方案进行语义和关键词搜索的 AI/ML 开发者
  • 希望通过避免单独向量服务来降低运维复杂度的平台工程师
  • 正在从 pgvector 或专用向量数据库迁移到更集成方案的团队

典型使用场景

  • 对大型文档集合(例如 Wikipedia 规模数据集)进行混合语义 + 关键词搜索
  • 支持多条件元数据约束(must/should/must_not)的过滤式商品或内容搜索
  • 在数据主权和 ACL 执行至关重要的 RAG 管道中进行数据库内 AI 检索
  • 在 MVCC 可见性下进行精确重新评分的实时推荐或相似性查询

项目优势

  • 在 GloVe‑100‑angular 基准测试中,同等召回率下 ANN 查询速度是 pgvector 的 3.8–5.3 倍
  • 支持过滤感知的 HNSW,即使选择性较强的元数据过滤器也能保持召回率,且无需单独维护过滤器索引
  • 混合检索(稠密 + 全文)内置于扩展中,无需外部粘合代码
  • 每个 ANN 候选结果都会对实际行进行精确重新评分,并遵循 PostgreSQL 的 MVCC、RLS 和 ACL

使用前须知

  • 属于早期扩展(v0.1.0/v0.2.0),仅支持 PostgreSQL 17 和 18,且不兼容 pgvector 的名称
  • 尚未实现 IVFFlat 索引;当前版本未测量 x86 的性能表现
  • 从源码构建需要 Rust 1.96.0 和 cargo‑pgrx 0.19.1,可能增加部分团队的安装复杂性

README 快速开始

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

项目描述

A full AI search engine, built into Postgres.

相关仓库与替代方案

根据分类、Topic 和编程语言匹配的相似项目。

Blaizzy
精选
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 与机器学习AI 智能体
890
RongleCat
精选
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 与机器学习AI 智能体
266
ogulcancelik
精选
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 与机器学习开发者工具
20,632