Repository navigation
Conversation
|
Workflow [PR], commit [9481e21] Summary: ✅
AI ReviewSummaryThis PR defers column materialization out of ordered merges and replays it on worker threads for Findings
Final Verdict
LLVM Coverage ReportMeasured on commit 9481e21.
Changed lines: Changed C/C++ lines covered: 392/447 (87.70%) · Uncovered code |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Object file sizes114 object files changed (+374.83 KiB total), 2 added.
716 more object files are built by the master warmup baseline only (it builds every object-file target, a pull request build only Compile time of recompiled translation units803 translation units recompiled, 6279 s compile time in total, 797 of them have a recent master baseline. Symbol sizes
|
|
📊 Cloud Performance Report ✅ AI verdict: no significant changes detected. K_source=6 K_base=30 flagged=0/65 clickbench🟢 No significant changes tpch_adapted_1_official🟢 No significant changes Debug info
|
2f87de4 to
243d175
Compare
95f1877 to
0ca94e9
Compare
0ca94e9 to
76f565f
Compare
f449be4 to
7280152
Compare
08b9ef6 to
890aace
Compare
0d8a3f0 to
4b6e319
Compare
|
The unrelated failed test is being fixed in #117764. |
4b6e319 to
451605b
Compare
d5a3a4f to
33e012b
Compare
Ordered reads must merge input streams serially, but constructing the output columns does not determine row order. For wide results, materialization can dominate the single merge thread. This adds a deferred mode to `MergedData` that records source ranges instead of copying their columns immediately. Sequence numbers are assigned to completed plans, then they are materialized on a bounded set of workers and restored to their original order before passing the chunks downstream. Consecutive completed chunks are released without waiting for every worker. Each worker can buffer one additional block to reduce head-of-line blocking while keeping memory usage bounded. The new `max_parallel_ordered_merge_materialization_threads` setting controls the number of workers. Values of 0 (the default) and 1 disable the optimization. In the performance test with 8 input streams and 1024-row blocks, 4 workers reduced median time from 0.475s to 0.165s, a 2.89x speedup. On the production workload with matched settings, 8 workers reduced wall time from 178s to 69.2s, a 2.57x speedup. CPU increased from 312s to 346s and peak memory from 13.6 GiB to 15.2 GiB.
33e012b to
9481e21
Compare
| /// Version 21 registers the `max_parallel_ordered_merge_materialization_threads` plan setting. | ||
| /// It is written only towards peers at this version or above because older peers reject unknown | ||
| /// query-plan setting names. | ||
| static constexpr auto DBMS_QUERY_PLAN_SERIALIZATION_VERSION = 21; |
There was a problem hiding this comment.
Version-gating max_parallel_ordered_merge_materialization_threads inside SortingStep::Settings::updatePlanSettings only helps when we can serialize per peer. Here the parallel-replicas path still caches one plan blob at DBMS_QUERY_PLAN_SERIALIZATION_VERSION, and DBMS_MIN_QUERY_PLAN_SERIALIZATION_VERSION_WITH_PARALLEL_REPLICAS is kept aliased to that global version.
That means this bump to 21 now rejects v20 replicas from parallel-replica reads during a rolling upgrade even when the new setting is left at 0 and the plan could have been serialized compatibly for them. In other words, a purely opt-in local optimization becomes a mixed-version parallel-replicas compatibility regression.
Please either keep the parallel-replicas minimum on the last always-required layout version, or serialize the cached remote-plan blob at the minimum version advertised by the selected replicas.
There was a problem hiding this comment.
I can open a separate PR that would generalize this:
- Pick some baseline version.
- Bump it if a setting is non-default.
Even that is probably suboptimal. I don't think it belongs in this PR though. Multiple existing setting suffers from the same problem.
It's a non-trivial change to just add here.
|
Dear @nickitat, you haven't been active on this PR for 30 days. You will be unassigned. Will you continue working on it? If so, please feel free to reassign yourself. |
|
Dear @nickitat, you haven't been active on this PR for 30 days. You will be unassigned. Will you continue working on it? If so, please feel free to reassign yourself. |
Ordered reads must merge input streams serially, but constructing the output columns does not determine row order. For wide results, materialization can dominate the single merge thread.
This adds a deferred mode to
MergedDatathat records source ranges instead of copying their columns immediately. Sequence numbers are assigned to completed plans, then they are materialized on a bounded set of workers and restored to their original order before passing the chunks downstream.Consecutive completed chunks are released without waiting for every worker. Each worker can buffer one additional block to reduce head-of-line blocking while keeping memory usage bounded.
The new
max_parallel_ordered_merge_materialization_threadssetting controls the number of workers. Values of 0 (the default) and 1 disable the optimization.In the performance test with 8 input streams and 1024-row blocks, 4 workers reduced median time from 0.475s to 0.165s, a 2.89x speedup.
On the production workload with matched settings, 8 workers reduced wall time from 178s to 69.2s, a 2.57x speedup. CPU increased from 312s to 346s and peak memory from 13.6 GiB to 15.2 GiB.
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Parallelize ordered merge output materialization (opt-in via
max_parallel_ordered_merge_materialization_threads).Workflow [PR]
Sync PR [sync-upstream/pr/117123]