You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Stage 3 almost never selects query-time results kept across evaluations (Example 4 B3 costs 8,884.5/s vs 2.1/s) #754
The planner-layering Example 4 Pattern B workload has 1M series at 66,667 rows/s. Plan it with the default cost model (cost model 1, usage over time, ResourceUnitCost::illustrative()) and DeploymentCapabilities { query_time_results_retained: true, .. }.
Stage 3 prices the candidates as follows (per second of wall time):
Candidate
Materialization
Cost/s
B3 (P3-m2 shape): tumbling KLL panes computed at query time and kept across evaluations
MatAtQueryKeptAcrossEvaluations
8,884.5
P2: one whole-window KLL rebuilt at query time on every evaluation
MatAtQuery
2.1
So B3 never wins. A sweep from 1 to 1M series at consistent rates found that B3 is selected only at a 1 ms sample interval with 10 to 100 series. It is never selected at 15 s or 1 s intervals. The ASAPQuery-backend draft PR for kept query-time results (ASAPQuery-backend #824) had to use 10 series sampled every 1 ms to get a plan that keeps results at all.
Expected: keeping already-computed panes should be cheaper than rebuilding the whole window from raw samples whenever evaluations repeat faster than panes expire. That is the reason this materialization exists.
Likely cause (to confirm)
Cost model 1 charges the kept state as memory for every second it is held: about four kept panes, each holding 1M KLL sketches.
Rebuilding P2 is charged only CPU per evaluation plus transient memory. If the raw-scan CPU and the raw-data read per evaluation are underpriced, the comparison tilts further.
Proposal
Add a Stage 3 test that prints B3's and P2's ResourceUsage breakdown (CPU, memory byte-seconds, scanned bytes) for Pattern B, and check each term against the sizes the executor actually allocates.
Activity