/search-plan may over-fetch split metadata from PostgreSQL metastore on wide queries
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 55/100
调研方向
追踪 quickwit-search/src/root.rs 中的 search_plan,沿着 quickwit-search/src/lib.rs 的 list_relevant_splits 以及 PostgreSQL metastore 的 list_splits 路径进行。比较 /search-plan 和 /search 所需的字段与当前的 split 查询,然后验证广泛的规划请求不再获取 split_metadata_json,同时返回所需的 split 信息。
由索引模型根据 Issue 内容生成。
描述
Summary
We are routing through a proxy for guardrails, and before executing a /search query, we call /search-plan to determine whether the query is too heavy.
We observed that a small number of wide /<index>/search-plan requests can put noticeable CPU and read I/O pressure on the PostgreSQL metastore.
This may be related to how /search-plan currently uses the general-purpose list_splits metastore path. For PostgreSQL, that path appears to fetch full split rows, including split_metadata_json, even though the /search-plan response only needs split identifiers for searched_splits.
Environment
- Quickwit: e86f4fb9b21b97265698c92be66588e0725484e1
- Metastore backend: PostgreSQL (AWS Aurora PostgreSQL)
- Workload: low request rate, but some wide
/<index>/search-plancalls covering broad time ranges
Observed behavior
During the execution of /search-plan, the PostgreSQL Read Replica showed read-heavy load that was disproportionate to the request rate:
- DB CPU reached roughly 85–90%.
- Statement calls stayed in the single-digit calls/sec range.
- Active sessions were not saturated.
- Connection pool usage was low.
- Read throughput peaked around a few hundred MiB/s.
- Read IOPS peaked around tens of thousands per second.
- Returned/fetched tuples spiked sharply.
- Locks were mostly
AccessShareLock; no conflicts or deadlocks were observed.
This suggests the load is not caused by connection saturation, lock contention, or writes, but by a small number of read queries scanning and/or returning many rows.
As a mitigation we tried setting statement_timeout on the metastore connection, but it did not help: the heavy queries do not exceed the timeout, they simply do a lot of per-call work within it.
Suspected cause
/<index>/search-plan goes through the normal split planning path:
quickwit-search/src/root.rs—search_planquickwit-search/src/lib.rs—list_relevant_splits- PostgreSQL metastore —
list_splits
For PostgreSQL, list_splits builds a general-purpose split listing query and returns full split rows, including the large split_metadata_json TEXT column for every matched split. Each row is then JSON-deserialized into SplitMetadata on the Quickwit side.
The /search-plan response, however, only appears to use the split identifier from each split:
let split_ids = split_metadatas
.into_iter()
.map(|split| format!("{}/{}", split.index_uid.index_id, split.split_id))
.collect();
So for N matched splits, each /search-plan call appears to read and JSON-deserialize N full SplitMetadata values only to keep index_id and split_id from each. With wide queries (broad time range or * patterns) matching tens of thousands of splits, this is consistent with the read-heavy load we observed.
/<index>/search shares the same list_splits path. The downstream search code only uses a small number of scalar fields per split (index_uid, split_id, footer_offsets, time_range, num_docs), so a similar over-fetching shape likely applies there as well.
Possible improvement
Would it make sense to add a lightweight split listing path for planning-only use cases?
For /search-plan, the PostgreSQL metastore could avoid the general-purpose list_splits projection and fetch only the required identifiers, for example:
SELECT index_uid, split_id
FROM splits
WHERE ...
- 主要语言
- Rust
- 星标
- 11.8k
- 派生
- 628
- 平均合并
- 2 天 22 小时
- 30 天内合并 PR
- 50
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 提供 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
quickwit-oss/quickwit 的其他 Issue
-
area:otel documentation
难度 2/5 1-3 小时 新手友好度 68/100
quickwit-oss/quickwit#6686 ·
维护者通常 1 天内回复
-
Add some examples of requests in the REST API reference docs可能已有人在做 @Cunninger 于 88 天前认领。 未关闭enhancement good first issue
难度 2/5 1-3 小时 新手友好度 78/100
quickwit-oss/quickwit#4266 · 1 条评论 ·
维护者通常 1 天内回复
-
documentation
难度 1/5 1 小时以内 新手友好度 65/100
quickwit-oss/quickwit#3872 ·
维护者通常 1 天内回复
-
documentation
难度 1/5 1 小时以内 新手友好度 65/100
quickwit-oss/quickwit#3666 ·
维护者通常 1 天内回复
-
enhancement
难度 2/5 1-3 小时 新手友好度 65/100
quickwit-oss/quickwit#2769 ·
维护者通常 1 天内回复
查看 quickwit-oss/quickwit 的全部 Issue
相似的 Issue
-
p2 ready-mac
难度 2/5 1-3 小时 新手友好度 75/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
quickwit-oss/tantivy#3299 ·
维护者通常 1 天内回复
-
`stream enable` fails with "already enabled" on every fresh session since streaming became always-on未关闭
难度 2/5 1-3 小时 新手友好度 70/100
vercel-labs/agent-browser#2797 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 66/100
witchesofthehill/manabrew#1309 ·
维护者通常 1 天内回复
-
bug help wanted ui
难度 2/5 1-3 小时 新手友好度 82/100
userFRM/egui-charts#4494 ·
维护者通常 1 天内回复