/search-plan may over-fetch split metadata from PostgreSQL metastore on wide queries
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 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時間
- マージ済み PR(30日)
- 50
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- 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 日以内に返信