diff --git a/docs/design_docs/decisions/cse-cost-model.md b/docs/design_docs/decisions/cse-cost-model.md index ed7e54e08..7ada47bc5 100644 --- a/docs/design_docs/decisions/cse-cost-model.md +++ b/docs/design_docs/decisions/cse-cost-model.md @@ -1,9 +1,15 @@ -# CSE sharing: rule-based vs. cost-based framework (issue #237) +# Common sub-DAG sharing: rule-based vs. cost-based framework (issue #237) > Status: accepted decision for the implementation described here. ## Context +Sub-DAG sharing means multiple consumers reference one operator and its +upstream dependencies. Common sub-DAG sharing uses CSE (common subexpression +elimination) to identify eligible, structurally identical computations. A +shared logical node records an opportunity for reuse; selecting maintained +state or independent execution is a separate planning decision. + [`asap_types::pre_asap::cse::share_common_sub_dags`](../../../crates/types/src/pre_asap/cse.rs) (issue #223 stages 1-2, PR #235) already *detects* every structurally-identical, legally-shareable (`Schema::unique_keys`-gated) sub-DAG and shares it diff --git a/docs/design_docs/proposals/planner-layering.md b/docs/design_docs/proposals/planner-layering.md index fc268c6ab..5273bfb3f 100644 --- a/docs/design_docs/proposals/planner-layering.md +++ b/docs/design_docs/proposals/planner-layering.md @@ -261,7 +261,10 @@ exploits. #### Pass 2: ASAP-aware common-subexpression elimination -ASAP-aware CSE extends traditional CSE with summary-specific sharing rules. +**Sub-DAG sharing** means several consumers reference one operator and its +upstream dependencies. Traditional CSE provides common sub-DAG sharing for +eligible, structurally identical computations. ASAP-aware CSE extends it with +summary-specific sharing rules. Computations can share work when they use identical expressions, when one summary build node supports several estimates, or when one window summary can answer their overlapping windows. diff --git a/docs/develop_docs/asap-aware-mapping-architecture.md b/docs/develop_docs/asap-aware-mapping-architecture.md index 5170f7d91..aee8fe53a 100644 --- a/docs/develop_docs/asap-aware-mapping-architecture.md +++ b/docs/develop_docs/asap-aware-mapping-architecture.md @@ -60,9 +60,9 @@ Terminology used in the diagram: realizes an operation as a concrete ASAP realization; **post-ASAP** means the resulting realization form. - A **DAG** (directed acyclic graph) represents query operators whose sub-DAGs - may be shared. **CSE** (common subexpression elimination) finds equivalent - sub-DAGs and represents legal reuse by making them the same shared node. - Rust's `Rc` (reference-counted pointer) records that shared node identity. + may be shared. See [sub-DAG sharing and ASAP-aware CSE](../design_docs/proposals/planner-layering.md#pass-2-asap-aware-common-subexpression-elimination) + for the sharing rules. Rust's `Rc` (reference-counted pointer) records + shared node identity. - A **target** is one replaceable site. A **candidate** is one valid alternative for it. `Replacement::Summary` is a constructed post-ASAP summary—maintained state such as an exact accumulator or an approximate sketch—while