---
title: "Postgres 连接分组可能阻止索引查找计划生成"
canonical: "https://siyuanailab.com/curation/entry/c1c0146232815b5108d0334a7d106385/"
dateModified: "2026-11-02"
datePublished: "2026-11-02"
---

[← 返回日报](https://siyuanailab.com/curation/#entry/c1c0146232815b5108d0334a7d106385)

商业 / 中文摘编收录于 2026-11-02

# Postgres 连接分组可能阻止索引查找计划生成

原始来源

- [DEV Community · Changing one number from 32 to 34 made a Postgres query 6,000 faster. Here's exactly why. ↗](https://dev.to/payyavula_balanagaraju_6d/changing-one-number-from-32-to-34-made-a-postgres-query-6000x-faster-heres-exactly-why-4p79)原文发布：2026/11/2 05:58:23（北京时间）

依据原文整理。

[资料节译](https://siyuanailab.com/curation/translations/c1c0146232815b5108d0334a7d106385-5a46574797b6da97f25e86da96e15b0d2283be39e99daa63997f2a25b49cf814/)

六轴双评分均分：71.5 / 100

相关性 5.5 / 10 · 新信息 7.5 / 10 · 证据 7 / 10 · 推理 8.5 / 10 · 信息密度 8.5 / 10 · 行动价值 7 / 10

## 中文摘编

Postgres 15 及已发布版本会先按 join_collapse_limit 分组连接，再移除无用连接，这可能让需要索引查找的表落在不同组，使快速计划无法生成。作者测试中，限值为 32 时查询耗时 140,611 毫秒，调至 34 后为 23.9 毫秒；另一组测试中，限值 64 时耗时 91 毫秒。文章建议仅在该查询的事务内使用 SET LOCAL，并考虑减少查询列数、补充不允许重复键值的索引或减少视图层数。新代码若剩余表数仍超过限值，问题仍可能存在。

依据来源材料整理，保留事实、观点与适用范围的区别。  
完整上下文请阅读原始来源。

© 2026 思远 AI Labs
