Goal
Optimize the already-correct query-time implementation of:
topk(k, sum by (...) (metric))
into one CountMinSketchWithHeap precompute.
Intended plan
- Use
CountMinSketchWithHeap.
- Set its aggregated labels to the inner
sum by (...) labels.
- Use
sum weighting/subtype.
- Emit no query-time aggregation pipeline for this optimized shape.
Prerequisite
The generic nested-aggregation path must exist first, with sum by (...) (metric) as the planned anchor and query-time topk. It is the correctness baseline for this optimization.
Validation
Benchmark the CMS-with-heap path against that baseline and retain Prometheus-equivalence coverage.
Goal
Optimize the already-correct query-time implementation of:
into one
CountMinSketchWithHeapprecompute.Intended plan
CountMinSketchWithHeap.sum by (...)labels.sumweighting/subtype.Prerequisite
The generic nested-aggregation path must exist first, with
sum by (...) (metric)as the planned anchor and query-timetopk. It is the correctness baseline for this optimization.Validation
Benchmark the CMS-with-heap path against that baseline and retain Prometheus-equivalence coverage.