# pgContext: Full AI search engine inside Postgres (Open Source)
**作者**: dale
**日期**: 2026-07-21T14:41:46.000Z
**来源**: [https://x.com/daleverett/status/2079577581620441471](https://x.com/daleverett/status/2079577581620441471)
---

5.3× faster than pgvector, with hybrid retrieval, filter-aware vector search, and exact re-scoring built in. Read on for the core capabilities and benchmarks, and free hosted option.
Today, we’re launching pgContext: an open-source Postgres extension that turns the database you already run into a full AI search engine. No extra database required.
[here’s the repo, go feral →]
## pgContext core capabilities:
> TLDR: you can now use metadata filters alongside vectors without having to build indexes
pgContext provides the retrieval features you’d expect from a dedicated vector engine while keeping your application data, vectors, permissions, filters, backups, and replication inside PostgreSQL.

- Exact vector search and persisted, page-native HNSW indexes
- L2, inner-product, cosine, and L1 distance metrics
- Filter-aware ANN over registered columns and JSONB paths
- Exact-score rechecks under PostgreSQL MVCC, ACLs, and RLS
- Collections, scrolling, counts, facets, and grouping
- Dense and full-text hybrid retrieval with reciprocal-rank fusion
Everything in the database you already love. Sometimes maybe too much. It's ok. Postgres deserves all the love it can get.
## Benchmarks
On the standard GloVe-100-angular benchmark (1,183,514 vectors using cosine distance) pgContext delivered the same recall as pgvector with 3.8× to 5.3× lower median query latency.

Standard GloVe-100-angular benchmark.
Both extensions were tested in the same PostgreSQL 17 container with the same eight-way parallel build budget on an Apple M4 Pro (That's what @daltonmeon is using)
The advantage grows as you increase the recall target. At approximately 0.91 recall@10, pgContext answered queries in 2.44 ms, compared with 12.97 ms for pgvector.
That performance can also be spent on quality: within the same latency budget, pgContext can search more of the graph and return higher-recall results.
## Hybrid retrieval without application glue
Semantic similarity is not enough for every query. Product names, identifiers, exact phrases, error codes, and rare terms often benefit from lexical search.
pgContext combines dense vector retrieval with PostgreSQL full-text search and fuses both rankings using reciprocal-rank fusion.
No separate search service. No manual result-merging layer. No duplicated authorization model.
Just one retrieval system, running where your data already lives.
## pgContext is open source under Apache 2.0.
We’re a three-person team, so every GitHub star is both a metric and a small emotional support animal.
Clone it. Benchmark it. Throw Claude Code at it. Break it in ways we haven’t thought of yet. Open issues. Tell us what’s missing.
And if it looks useful, please star the repo. If it doesn’t look useful yet, star it optimistically and then tell us why. ⭐
GitHub → [Click Here]
Host on Polygres → [Click Here] (Free for limited time)
More Links Below!
## 相关链接
- [dale](https://x.com/daleverett)
- [@daleverett](https://x.com/daleverett)
- [11K](https://x.com/daleverett/status/2079577581620441471/analytics)
- [[here’s the repo, go feral →]](https://github.com/evokoa/pgContext)
- [@daltonmeon](https://x.com/@daltonmeon)
- [[Click Here]](https://github.com/evokoa/pgContext)
- [[Click Here]](https://polygres.com/)
- [Upgrade to Premium](https://x.com/i/premium_sign_up)
- [10:41 PM · Jul 21, 2026](https://x.com/daleverett/status/2079577581620441471)
- [11.4K Views](https://x.com/daleverett/status/2079577581620441471/analytics)
- [View quotes](https://x.com/daleverett/status/2079577581620441471/quotes)
---
*导出时间: 2026/7/22 08:57:29*
---
## 中文翻译
# pgContext: Postgres 内部的完整 AI 搜索引擎(开源)
**作者**: dale
**日期**: 2026-07-21T14:41:46.000Z
**来源**: [https://x.com/daleverett/status/2079577581620441471](https://x.com/daleverett/status/2079577581620441471)
---

比 pgvector 快 5.3 倍,内置混合检索、具备过滤感知的向量搜索以及精确重评功能。继续阅读了解核心能力、基准测试和免费托管选项。
今天,我们正式发布 pgContext:一个开源的 Postgres 扩展,能将您已经在运行的数据库转变为完整的 AI 搜索引擎。无需额外的数据库。
[这是代码仓库,尽管去折腾 →]
## pgContext 核心能力:
> 长话短说:您现在可以配合向量使用元数据过滤器,而无需构建索引
pgContext 提供了您期望从专用向量引擎获得的检索功能,同时将您的应用数据、向量、权限、过滤器、备份和复制都保留在 PostgreSQL 内部。

- 精确向量搜索和持久化、原生页面的 HNSW 索引
- L2、内积、余弦和 L1 距离度量
- 针对已注册列和 JSONB 路径的具备过滤感知的 ANN(近似最近邻)
- 在 PostgreSQL MVCC、ACLs 和 RLS 下的精确分数重检
- 集合、滚动、计数、分面和分组
- 使用倒数排名融合(Reciprocal-rank fusion)的密集和全文混合检索
一切尽在您已钟爱的数据库中。有时可能爱得有点过分。没关系。Postgres 值得拥有所有的爱。
## 基准测试
在标准的 GloVe-100-angular 基准测试(1,183,514 个向量,使用余弦距离)中,pgContext 实现了与 pgvector 相同的召回率,但中位查询延迟降低了 3.8 倍至 5.3 倍。

标准 GloVe-100-angular 基准测试。
两个扩展都在同一个 PostgreSQL 17 容器中,在 Apple M4 Pro 上使用相同的八路并行构建预算进行了测试(这也是 @daltonmeon 正在使用的配置)
随着您提高召回率目标,优势会进一步扩大。在大约 0.91 的召回率@10 下,pgContext 在 2.44 毫秒内回答查询,而 pgvector 需要 12.97 毫秒。
这种性能也可以用于提升质量:在相同的延迟预算内,pgContext 可以搜索更多的图并返回更高召回率的结果。
## 无需应用胶水代码的混合检索
语义相似性并非对每个查询都足够。产品名称、标识符、精确短语、错误代码和罕见术语通常更能从词法搜索中受益。
pgContext 将密集向量检索与 PostgreSQL 全文搜索相结合,并使用倒数排名融合来融合两种排名。
没有独立的搜索服务。没有手动结果合并层。没有重复的授权模型。
只有一个检索系统,运行在您的数据所在地。
## pgContext 基于 Apache 2.0 协议开源。
我们是一个三人团队,所以每一个 GitHub Star 既是一个指标,也是一只小小的情感支持动物。
克隆它。对它进行基准测试。把 Claude Code 扔给它。以我们未曾想过的方式打破它。提交 Issue。告诉我们缺少了什么。
如果它看起来有用,请给仓库点个 Star。如果它看起来还没什么用,抱着乐观的心态点个 Star,然后告诉我们原因。⭐
GitHub → [点击这里]
在 Polygres 上托管 → [点击这里] (限时免费)
更多链接在下方!
## 相关链接
- [dale](https://x.com/daleverett)
- [@daleverett](https://x.com/daleverett)
- [11K](https://x.com/daleverett/status/2079577581620441471/analytics)
- [[here’s the repo, go feral →]](https://github.com/evokoa/pgContext)
- [@daltonmeon](https://x.com/@daltonmeon)
- [[Click Here]](https://github.com/evokoa/pgContext)
- [[Click Here]](https://polygres.com/)
- [Upgrade to Premium](https://x.com/i/premium_sign_up)
- [10:41 PM · Jul 21, 2026](https://x.com/daleverett/status/2079577581620441471)
- [11.4K Views](https://x.com/daleverett/status/2079577581620441471/analytics)
- [View quotes](https://x.com/daleverett/status/2079577581620441471/quotes)
---
*导出时间: 2026/7/22 08:57:29*