Repository navigation
Joint planning search: without raw data, skip plans that scan it at query time (method 2 at Stages 1-2) - #806
Merged
Merged
Conversation
zzylol
force-pushed
the
feat/joint-search-2-components
branch
from
October 21, 2026 07:14
ac26fcf to
f10d719
Compare
zzylol
force-pushed
the
feat/joint-search-3-raw-assignments
branch
from
October 21, 2026 07:30
8efcd83 to
d9a55a6
Compare
zzylol
force-pushed
the
feat/joint-search-2-components
branch
from
October 21, 2026 08:16
f10d719 to
5710f34
Compare
…it at query time (method 2 at Stages 1 and 2) In a deployment that keeps no raw data, Stage 3 rejects every physical candidate with a scan at query time (RawDataNotRetained). On ASAPQuery's MVP workloads that is all but a few dozen of hundreds of thousands of candidates. The default search now leaves them out before building them: - Stage 2: optimize_physical_asap_without_query_time_raw_scans skips each materialization assignment that leaves a scan reachable from a root without passing a build materialized at ingestion time; candidates keep their positions, so their ids are the exhaustive search's. - Stage 1: a candidate is not enumerated when even its most-at-ingestion assignment scans raw data at query time (every_assignment_scans_raw_at_query_time), nor are its identical-expression Pass 2 candidates, since sharing identical nodes never makes a build eligible for ingestion. The selection report counts both (raw_scan_assignments_skipped, raw_scan_candidates_skipped), and a failed selection names a skipped candidate with RawDataNotRetained.
…he exhaustive search's Stage 1 number
zzylol
force-pushed
the
feat/joint-search-3-raw-assignments
branch
from
October 21, 2026 08:44
d9a55a6 to
209661b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
With #797, the 7 queries over
datain ASAPQuery's MVP setting take 138 s:--no-raw);145,312 physical candidates are checked, and 145,264 of them are rejected for the same reason: they scan raw data at query time (
RawDataNotRetained). Only 48 are valid. Each rejected candidate is still composed, implemented and priced first.This applies method 2 of
docs/design_docs/proposals/joint-planning-search.md("Reject permanently invalid branches") to Stage 2 assignments and to Stage 1 candidates. The pruning methods mapped to the next PRs (1, 6 and 7, then 3 and 4) come after it. This one removes most of the product on the MVP workloads first.Builds on #797. Part of #673.
What
In a deployment that keeps no raw data, the default search no longer builds what Stage 3 would reject for scanning raw data at query time.
Scanwithout passing a summary build materialized at ingestion time. Such a scan runs at query time, so that assignment is rejected whatever else it chooses. The remaining candidates keep their positions in their Stage 1 candidate's list (-m<k>);P<n>counts only the Stage 1 candidates enumerated, so ids can differ from the exhaustive search's.SearchReportgainsraw_scan_assignments_skippedandraw_scan_candidates_skipped. When no candidate is valid,NoValidCandidatestill carries aRawDataNotRetainedrejection for what was skipped.How
physical-asap-optimization).optimize_physical_asap_without_query_time_raw_scansenumerates the same assignments asoptimize_physical_asapand drops thosereads_raw_at_query_timeflags. That check is a walk from the roots that stops at builds assignedMatAtIngestion.every_assignment_scans_raw_at_query_timeruns the same walk for the assignment with every eligible build at ingestion.logical-asap-optimization).stage1_logical_asap_optimization_skippingtakes aviablepredicate.Pass2List::pushlists a candidate only when it is viable, and its callers expand identical-expression candidates only from viable ones.plan-selection). The predicate isevery_assignment_scans_raw_at_query_timewhen the deployment keeps no raw data; otherwise it accepts everything. The components' membership check (Joint planning search: search independent components separately (method 5) #797) uses the same predicate.Key code interfaces added / modified
crates/physical-asap-optimization/src/lib.rscrates/logical-asap-optimization/src/workload_candidates.rscrates/plan-selection/src/lib.rsUsage
The user plans the first 7 PromQL queries of seed-862 workload-01 for a deployment that keeps no raw data, using the coverage converter with
--no-raw --failure-probability 0.3:(The numbers come from running the coverage converter against this commit. The converter isn't part of this PR.)
Before this PR
With #797 and the MVP flags (
--no-raw --failure-probability 0.3), seed-862 workload-01, PromQL prefixes:After this PR
The same plans are selected at the same costs (5, 6 and 7 queries compared with #797).
All 30 ASAPQuery workloads, PromQL only (9 queries each), MVP flags,
plan_installableend to end:Every workload splits into two components (7 + 2 queries), and Stage 3 checks 19–98 candidates.
On the long set, most of the time is not in the search. A profile shows it in the installable plan's expansion and checks of the pane DAG: executor
preflight_depth,logical::restoreandPhysicalASAPDAG::validate. With the long windows that DAG grows to about 5,300 nodes. That is follow-up work outside the search.Verification
cargo test --workspace --locked: passes.joint_search_equivalence.rs. Each check compares the default search withStage1ToStage3Search::exhaustive()(plan, cost, physical DAG, materialization, front). New tests:without_raw_data_random_workloads_select_the_exhaustive_plan: 60 seeded random workloads over two gauges and a counter, without raw data, each under one cost model in turn. It also asserts that some assignments were actually left out.without_raw_data_planner_layering_examples_select_the_exhaustive_plan: Examples 1 and 2 and Pattern B, without raw data, under every cost model.runtime_install.rs(test(planner): assert the undeclared-gauge p99 outcome, not a candidate id #801's tests).P3-m1on main,P1-m1here), which depends on what the search enumerates. Its plan, answer and bound checks are unchanged.RawDataNotRetainedrejection rather than the idP1./usr/bin/timearound the coverage converter, with the MVP flags. Selections were compared with Joint planning search: search independent components separately (method 5) #797.