InfoQ

Open Source pg_vectorsearch Brings More Scalable Vector Search to PostgreSQL

6.9内容质量
Open Source pg_vectorsearch Brings More Scalable Vector Search to PostgreSQL

TL;DR · AI 摘要

Open Source pg vectorsearch Brings More Scalable Vector Search to PostgreSQL - InfoQ InfoQ Homepage News Open Source pg...

核心要点

  • 主题聚焦:Open Source pg vectorsearch Brings More Scalable
  • 来源:InfoQ,建议结合原文判断细节。
  • AI 分析暂不可用,本条为保底评分与摘要。
#AI#编程#前端#后端#安全
打开原文

Open Source pg_vectorsearch 为 PostgreSQL 带来更可扩展的向量搜索 - InfoQ

InfoQ 首页 News Open Source pg_vectorsearch 带来更可扩展的 PostgreSQL 向量搜索

AI, ML & Data Engineering

QCon AI New York (12 月 15-16 日): 高级工程师分享生产级 AI 实践经验。

Open Source pg_vectorsearch 为 PostgreSQL 带来更可扩展的向量搜索

2026 年 11 月 7 日 3 分钟阅读

作者:

  • Renato Losio

#### 关注我们

Youtube

232K 粉丝

Linkedin

26K 粉丝

Instagram

新

RSS

19K 读者

X

57.1k 粉丝

Facebook

21K 点赞

Bluesky

收听本文 -

0:00

音频已准备就绪

您的浏览器不支持音频元素。

正常

1.25x

1.5x

喜欢

新下拉阅读列表

  • 阅读列表

Tiger Data 发布了 pg_vectorsearch,这是一个用于向量相似性搜索的开源 PostgreSQL 扩展,目前处于 alpha 阶段。其 PRISM 索引采用数据分片和压缩技术,而非 pgvector 的 HNSW 索引所使用的基于图的方法,从而降低内存需求并减少索引构建时间。

根据作者介绍,pg_vectorsearch 能够在 PostgreSQL 中实现更快、更节省内存的向量搜索,减少处理大规模向量数据集所需的基础设施。该扩展支持现有的 pgvector 列,使应用程序无需单独数据库即可执行向量搜索。要使用新功能,开发者需要安装扩展并在向量列上创建 PRISM 索引:

code
CREATE EXTENSION pg_vectorsearch;
CREATE INDEX ON documents USING prism (embedding vec32_l2_ops);

在 Tiger Data 自己的基准测试中,使用 1 亿个向量时,PRISM 在配备 128 GB 内存的机器上构建索引仅需 1 小时 40 分钟,而 HNSW(分层可导航小世界)在配备 512 GB 内存的机器上需要 42 小时。前身为 Timescale 的 Tiger Data 是 TimescaleDB 的开发公司,这是一个用于时序数据和实时分析的开源 PostgreSQL 扩展。

Tiger Data 的高级工程师 Erik Nordström、首席工程师 Matvey Arye 以及产品市场经理 Noah Hein 写道:

PRISM 为 PostgreSQL 带来了基于分片的方法,类似于新一代专用向量搜索系统采用的方案。PRISM 不是通过图将每个向量连接到其邻居,而是将相似向量分组到分片中,并以压缩格式存储为列表,密集地打包到数据库页面中。

虽然 HNSW 是一种近似最近邻算法,可在大规模数据集中快速找到与查询相似的向量,但 PRISM 会将搜索范围缩小到相关分片,并按顺序扫描压缩后的向量。这减少了索引大小,避免了昂贵的随机内存或磁盘访问,从而在 PostgreSQL 中实现更快的向量搜索并减少 RAM 使用。

Tiger Data 的联合创始人兼 CTO Michael Freedman 发表了一篇文章,描述了 PRISM 向量索引的架构。pg_vectorsearch 中的索引结合了分层聚类以缩小搜索空间、压缩向量以实现高效顺序扫描,以及 RaBitQ 量化以减少昂贵的距离计算。它复制了靠近分片边界的向量以提高召回率,并依赖 PostgreSQL 的原生存储、日志和并发机制。

来源:Freedman 在 LinkedIn 上的发布

增量重平衡功能尚未完全实现,因此频繁的数据变更可能需要重建索引以保持搜索效率。Freedman解释道:

更困难的问题在于随着数据集变化时保持聚类。当新向量到达时,质心不会自动移动,而倒排列表会逐渐失去原有的物理局部性。我们目前仅支持对过大倒排列表进行有限的按需拆分(针对扁平索引),但更通用的重平衡操作(包括合并和重新分配)尚未实现。

在一篇热门的Hacker News讨论帖中,总体反应是技术兴趣与谨慎并存。实践者看到PostgreSQL内部实现更快向量搜索并降低内存需求的潜力,但对独立基准验证提出疑问,质疑pg_vectorsearch是否能替代pgvectorscale,以及缺乏对过滤搜索的支持。Hermon Hagos评论道:

向量搜索刚刚变得更便宜(...) 对于那些在单一数据库上构建RAG应用且预算紧张的我们来说,这非常重要。无需启动独立的向量存储或更大服务器即可实现快速语义搜索,这能真正节省成本。它仍处于alpha阶段,因此不要立即部署给客户,但这是一个值得关注的项目。

尽管尚未经过独立验证,Tiger Data的基准测试使用了开源工具,测量了recall@10与精确搜索结果的对比,并在相同PostgreSQL配置和实例类型下比较了两种索引,使用pgvector的16位halfvec实现HNSW。

新向量扩展要求PostgreSQL 18或更高版本,目前支持最多1968维的向量。在通用可用性之前,不支持结合WHERE和ORDER BY的过滤向量搜索。该项目的代码可在GitHub上获取。Tiger Data计划将其现有的pgvectorscale扩展移至维护模式。

main wrapper for authors section

关于作者

section title

main wrapper for each author

#### Renato Losio

显示更多

显示更少

#### 本内容属于AI、机器学习与数据工程主题

##### 相关主题:

  • 开发
  • AI、机器学习与数据工程
  • 向量数据库
  • 数据库
  • 开源
  • 关系型数据库
  • Postgres
  • 相关编辑推荐
  • 相关赞助商 AI的物理约束:AI如何重塑数据中心
  • 相关赞助商 专为时间序列扩展而生的PostgreSQL 处理海量时间序列数据,无需牺牲性能。了解Tiger Data如何实现高速数据摄入、快速查询和可扩展存储。了解更多。

InfoQ新闻通讯

每周五汇总InfoQ最新内容,每周二发送。加入超过25万名高级开发者的社区。查看示例

我们保护您的隐私。 </think>

markdown
Incremental rebalancing is not yet fully implemented, so frequent data changes may require rebuilding the index to maintain search efficiency. Freedman explains:

> The harder problem is maintaining the clustering as the dataset changes. Centroids don't automatically move when new vectors arrive, and posting lists gradually lose their original physical locality. We currently support limited on-demand splitting of oversized posting lists for flat indexes, but the more general rebalancing operations, including merging and reassignment, are not implemented yet.

In a popular Hacker News thread, the overall reaction is one of technical interest but caution. Practitioners see potential in faster vector search with lower memory requirements inside PostgreSQL, but raise questions about independent benchmark validation, whether pg_vectorsearch could replace pgvectorscale, and the lack of support for filtered searches. Hermon Hagos comments:

> Vector search just got cheaper (...) For those of us building RAG apps on one database and a tight budget, that matters. Fast semantic search without spinning up a separate vector store or a bigger server is real money saved. It is still alpha, so do not ship it to clients yet, but this is one to watch closely.

Although not independently validated, Tiger Data’s benchmarks use an open source tool, measure recall@10 against exact search results, and compare both indexes under the same PostgreSQL configuration and instance types, using pgvector’s 16-bit halfvec for HNSW.

The new vector extension requires PostgreSQL 18 or later and currently supports vectors with up to 1968 dimensions. Filtered vector searches combining WHERE and ORDER BY are not supported until general availability. The project's code is available on GitHub. Tiger Data plans to move its existing pgvectorscale extension into maintenance mode.

main wrapper for authors section

## About the Author

section title

main wrapper for each author

#### Renato Losio

Show more

Show less

#### This content is in the AI, ML & Data Engineering topic

##### Related Topics:

- Development

- AI, ML & Data Engineering

- vector databases

- Database

- Open Source

- Relational Databases

- Postgres

- Related Editorial

- Related Sponsors AI's Physical Constraints: How AI Rewired the Data Center

- Related Sponsor PostgreSQL Built for Time-Series Scale Handle massive time-series data with PostgreSQL, without sacrificing performance. Discover how Tiger Data delivers high-speed ingest, fast queries, and scalable storage. Learn More .

### The InfoQ Newsletter

A round-up of last week’s content on InfoQ sent out every Tuesday. Join a community of over 250,000 senior developers. View an example

We protect your privacy.