Skip to content

Tracking: plan every whole evaluation workload within 3 minutes (exact pruning, memo-group search) #879

Open

Description

@zzylol

Problem, by example

The paper's evaluation workloads do not plan under the default search in reasonable time. Measured on origin/main (default search, raw data retained, cost model 1, 56-core server):

Workload Queries Result today
W-RangeHeavy (whole) 46 (50 RQEs) no plan after 30 min, 78 GB RSS
W-RangeHeavy, 8 users (whole) 84 killed at the 100 GB cap after 14 min
W-RangeHeavy component quantiles-24h@60s (6 quantile queries over one window) 6 1.6M candidates, about 19 min; after #860 (ratio bound), 11.86M candidates, about 3 h
W-RollupHeavy (whole, SQL) 62 no plan after 20 min, ≥16 GB and growing

With the exact pruning in progress (dominance plus interchangeable candidates, branch feat/joint-search-dominance), quantiles-24h@60s drops to 153k candidates in 92 s. Whole W-RollupHeavy still has no plan after 25 min.

Goal: every whole paper workload (W-RangeHeavy, W-RollupHeavy, W-Mixed, and the 8-user versions) plans under the default search within 5 minutes, and selects the same plan as --exhaustive would.

Why it happens

Proposal

Exact pruning first, then a memo-group search:

  1. Exact pruning (v5).
    • Merge interchangeable candidates: identical queries, and quantiles over the same input and window that differ only in q.
    • Drop a variant that another variant in the same sharing group matches or beats on every usage component (CPU, scanned bytes, memory byte-seconds, peak memory, disk, each reader's latency).
  2. Memo groups.
    • One group per hash-consed logical sub-expression or target.
    • Each group enumerates its own alternatives once and references child groups instead of taking cross products of whole plans.
  3. Cheapest per sharing signature.
    • A candidate's sharing signature is the shareable nodes it builds or reads: family, sizing-relevant parameters, timing, pane grid.
    • Within a group, keep the cheapest candidate per signature, priced locally and cached per group.
    • A candidate whose signature nothing else can use collapses to the group's single cheapest. Where a group shares nothing, the local optimum is the global one.
  4. Joint choice only inside sharing clusters.
    • Enumerate signature combinations (exact DP or branch and bound) only among groups that can share a node.
    • A shared node is priced once, sized for its strictest reader.
  5. Build late. Build the full physical DAG and run the executor compile check only for the selected plan and a few runners-up.

The memo work lands behind the current search until a switch-over PR, so main never regresses.

Scope and acceptance

  • In scope: the search between Stage 1 and Stage 3 selection, its caches, and the joint-search design doc.
  • Out of scope: approximate or heuristic caps. Any rule not proven exact is listed as a follow-up instead of merged.
  • Acceptance:
    • joint_search_equivalence (against --exhaustive) passes, including the ignored slow tests;
    • each whole paper workload plans within 5 minutes under the default search;
    • the planning time, peak RSS and candidates checked are reported per workload.

Tasks

  • Exact pruning v5: dominance plus interchangeable candidates (branch feat/joint-search-dominance)
  • Design and interfaces for memo groups, sharing signatures, local pricing and the cluster solver (joint-search design doc)
  • Memo structure plus Stage 1/2 enumeration into groups
  • Per-group, per-signature pricing and caching (local dominance)
  • Joint selection inside sharing clusters; build and compile-check only the selection
  • Switch-over: the default search uses memo groups; equivalence and timing acceptance
  • Re-run the paper workloads whole and update the evaluation report

Status and related work

Activity

  1. zzylol commented on Oct 22, 2026

    @zzylol
    ContributorAuthor

    Decision (2026-10-22): the memo groups are per logical sub-expression (Cascades style), not per query. This is the long-term design, and it is done in one step.

    • Each distinct sub-expression of the hash-consed workload DAG is one group. Identical-expression sharing is group identity.
    • Pass 1 emits, per group, the implementations of that node, which reference child groups. A fused computation is one implementation covering several groups.
    • The other Pass 2 rules (summary capability, window composition, rollup, top-k reuse) become transformations that add implementations to groups.
    • Stage 2's materialization is chosen per group implementation, once for a group with several parents.
    • The search is exact. Bottom-up DP over the group DAG, with Stage 3 per-node pricing cached per group and implementation. Only the choices of shared groups (size threshold, materialization, pane grid) are enumerated, with branch and bound. Raw retention is a per-source site. Cost models 2 and 3 keep Pareto frontiers.
    • The full physical plan is built, and the compile check runs, only for the selected plan.

    The current search stays behind a flag until the switch-over PR. The acceptance criteria are unchanged.

  2. zzylol commented on Oct 22, 2026

    @zzylol
    ContributorAuthor

    Solver choice tracked in #888: DP + threshold enumeration + branch and bound for cost model 1 (phase 1), MILP over the same memo for cost models 2 and 3, and a cross-check mode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions