From 3e5951c5950d0c9da9564b1eef440476ea5c906f Mon Sep 17 00:00:00 2001 From: Milind Srivastava Date: Wed, 18 Nov 2026 10:58:40 -0500 Subject: [PATCH 1/2] test(devtools): sketch plan snapshots for 32 small single-purpose workloads (#1278) Each workload exercises one planner behavior: rollup across label sets, top-k reuse, chain widths and sharing, avg as Sum / Count, and which sketches an accuracy target or a declared value sign admits. Its `covers` line says what the workload exercises, not which plan is selected, so a plan change needs no rewording. Existing snapshots are unchanged. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_014qhwq4GZoWwtfFWWr9CKkr --- .../devtools/tests/sketch_plan_snapshots.rs | 6 + .../avg-nested-labels-raw-retained.json | 1095 ++++++++++ .../chains-10m-5m-3m-10s-mvp.json | 1791 ++++++++++++++++ .../chains-10m-5m-3m-10s-raw-retained.json | 915 ++++++++ .../chains-10m-5m-3m-3m-raw-retained.json | 915 ++++++++ .../distinct-over-time-1pct-raw-retained.json | 588 +++++ .../distinct-over-time-5pct-raw-retained.json | 1156 ++++++++++ .../distinct-two-forms-raw-retained.json | 892 ++++++++ .../entropy-and-distinct-raw-retained.json | 711 ++++++ .../entropy-over-time-raw-retained.json | 358 ++++ .../tests/sketch_plan_snapshots/manifest.json | 194 ++ .../mixed-quantiles-raw-retained.json | 1908 +++++++++++++++++ .../quantile-7m-every-5m-raw-retained.json | 359 ++++ .../quantile-exact-raw-retained.json | 359 ++++ ...antile-over-time-phase-0-raw-retained.json | 827 +++++++ ...quantile-phase-0-and-30s-raw-retained.json | 684 ++++++ .../quantile-two-targets-raw-retained.json | 366 ++++ ...quantile-disjoint-labels-raw-retained.json | 746 +++++++ ...p-quantile-nested-labels-raw-retained.json | 790 +++++++ .../rollup-sum-chain-raw-retained.json | 759 +++++++ .../sign-non-negative-raw-retained.json | 592 +++++ .../sign-unknown-raw-retained.json | 592 +++++ ...antile-different-windows-raw-retained.json | 1259 +++++++++++ ...lup-quantile-same-window-raw-retained.json | 1261 +++++++++++ .../stddev-nested-labels-raw-retained.json | 790 +++++++ ...sum-5m-avg-10m-over-time-raw-retained.json | 588 +++++ .../sum-avg-over-time-5m-raw-retained.json | 482 +++++ ...-over-time-two-intervals-raw-retained.json | 682 ++++++ .../topk-5-and-10-accuracy-raw-retained.json | 573 +++++ .../topk-5-and-10-raw-retained.json | 573 +++++ .../topk-by-job-and-global-raw-retained.json | 944 ++++++++ .../topk-rate-counter-raw-retained.json | 684 ++++++ ...count-over-time-accuracy-raw-retained.json | 699 ++++++ ...topk-sum-count-over-time-raw-retained.json | 699 ++++++ .../workloads/avg-nested-labels.json | 70 + .../workloads/chains-10m-5m-3m-10s.json | 82 + .../workloads/chains-10m-5m-3m-3m.json | 82 + .../workloads/distinct-over-time-1pct.json | 65 + .../workloads/distinct-over-time-5pct.json | 65 + .../workloads/distinct-two-forms.json | 66 + .../workloads/entropy-and-distinct.json | 65 + .../workloads/entropy-over-time.json | 45 + .../workloads/mixed-quantiles.json | 107 + .../workloads/quantile-7m-every-5m.json | 45 + .../workloads/quantile-exact.json | 40 + .../workloads/quantile-over-time-phase-0.json | 56 + .../workloads/quantile-phase-0-and-30s.json | 65 + .../workloads/quantile-two-targets.json | 65 + .../rollup-quantile-disjoint-labels.json | 65 + .../rollup-quantile-nested-labels.json | 65 + .../workloads/rollup-sum-chain.json | 70 + .../workloads/sign-non-negative.json | 68 + .../workloads/sign-unknown.json | 65 + ...sql-rollup-quantile-different-windows.json | 67 + .../sql-rollup-quantile-same-window.json | 67 + .../workloads/sql-table-data.tables.json | 24 + .../workloads/stddev-nested-labels.json | 55 + .../workloads/sum-5m-avg-10m-over-time.json | 55 + .../workloads/sum-avg-over-time-5m.json | 55 + .../sum-over-time-two-intervals.json | 55 + .../workloads/topk-5-and-10-accuracy.json | 65 + .../workloads/topk-5-and-10.json | 55 + .../workloads/topk-by-job-and-global.json | 55 + .../workloads/topk-rate-counter.json | 55 + .../topk-sum-count-over-time-accuracy.json | 65 + .../workloads/topk-sum-count-over-time.json | 55 + 66 files changed, 27816 insertions(+) create mode 100644 crates/devtools/tests/sketch_plan_snapshots/avg-nested-labels-raw-retained.json create mode 100644 crates/devtools/tests/sketch_plan_snapshots/chains-10m-5m-3m-10s-mvp.json create mode 100644 crates/devtools/tests/sketch_plan_snapshots/chains-10m-5m-3m-10s-raw-retained.json create mode 100644 crates/devtools/tests/sketch_plan_snapshots/chains-10m-5m-3m-3m-raw-retained.json create mode 100644 crates/devtools/tests/sketch_plan_snapshots/distinct-over-time-1pct-raw-retained.json create mode 100644 crates/devtools/tests/sketch_plan_snapshots/distinct-over-time-5pct-raw-retained.json create mode 100644 crates/devtools/tests/sketch_plan_snapshots/distinct-two-forms-raw-retained.json create mode 100644 crates/devtools/tests/sketch_plan_snapshots/entropy-and-distinct-raw-retained.json create mode 100644 crates/devtools/tests/sketch_plan_snapshots/entropy-over-time-raw-retained.json create mode 100644 crates/devtools/tests/sketch_plan_snapshots/mixed-quantiles-raw-retained.json create mode 100644 crates/devtools/tests/sketch_plan_snapshots/quantile-7m-every-5m-raw-retained.json create mode 100644 crates/devtools/tests/sketch_plan_snapshots/quantile-exact-raw-retained.json create mode 100644 crates/devtools/tests/sketch_plan_snapshots/quantile-over-time-phase-0-raw-retained.json create mode 100644 crates/devtools/tests/sketch_plan_snapshots/quantile-phase-0-and-30s-raw-retained.json create mode 100644 crates/devtools/tests/sketch_plan_snapshots/quantile-two-targets-raw-retained.json create mode 100644 crates/devtools/tests/sketch_plan_snapshots/rollup-quantile-disjoint-labels-raw-retained.json create mode 100644 crates/devtools/tests/sketch_plan_snapshots/rollup-quantile-nested-labels-raw-retained.json create mode 100644 crates/devtools/tests/sketch_plan_snapshots/rollup-sum-chain-raw-retained.json create mode 100644 crates/devtools/tests/sketch_plan_snapshots/sign-non-negative-raw-retained.json create mode 100644 crates/devtools/tests/sketch_plan_snapshots/sign-unknown-raw-retained.json create mode 100644 crates/devtools/tests/sketch_plan_snapshots/sql-rollup-quantile-different-windows-raw-retained.json create mode 100644 crates/devtools/tests/sketch_plan_snapshots/sql-rollup-quantile-same-window-raw-retained.json create mode 100644 crates/devtools/tests/sketch_plan_snapshots/stddev-nested-labels-raw-retained.json create mode 100644 crates/devtools/tests/sketch_plan_snapshots/sum-5m-avg-10m-over-time-raw-retained.json create mode 100644 crates/devtools/tests/sketch_plan_snapshots/sum-avg-over-time-5m-raw-retained.json create mode 100644 crates/devtools/tests/sketch_plan_snapshots/sum-over-time-two-intervals-raw-retained.json create mode 100644 crates/devtools/tests/sketch_plan_snapshots/topk-5-and-10-accuracy-raw-retained.json create mode 100644 crates/devtools/tests/sketch_plan_snapshots/topk-5-and-10-raw-retained.json create mode 100644 crates/devtools/tests/sketch_plan_snapshots/topk-by-job-and-global-raw-retained.json create mode 100644 crates/devtools/tests/sketch_plan_snapshots/topk-rate-counter-raw-retained.json create mode 100644 crates/devtools/tests/sketch_plan_snapshots/topk-sum-count-over-time-accuracy-raw-retained.json create mode 100644 crates/devtools/tests/sketch_plan_snapshots/topk-sum-count-over-time-raw-retained.json create mode 100644 crates/devtools/tests/sketch_plan_snapshots/workloads/avg-nested-labels.json create mode 100644 crates/devtools/tests/sketch_plan_snapshots/workloads/chains-10m-5m-3m-10s.json create mode 100644 crates/devtools/tests/sketch_plan_snapshots/workloads/chains-10m-5m-3m-3m.json create mode 100644 crates/devtools/tests/sketch_plan_snapshots/workloads/distinct-over-time-1pct.json create mode 100644 crates/devtools/tests/sketch_plan_snapshots/workloads/distinct-over-time-5pct.json create mode 100644 crates/devtools/tests/sketch_plan_snapshots/workloads/distinct-two-forms.json create mode 100644 crates/devtools/tests/sketch_plan_snapshots/workloads/entropy-and-distinct.json create mode 100644 crates/devtools/tests/sketch_plan_snapshots/workloads/entropy-over-time.json create mode 100644 crates/devtools/tests/sketch_plan_snapshots/workloads/mixed-quantiles.json create mode 100644 crates/devtools/tests/sketch_plan_snapshots/workloads/quantile-7m-every-5m.json create mode 100644 crates/devtools/tests/sketch_plan_snapshots/workloads/quantile-exact.json create mode 100644 crates/devtools/tests/sketch_plan_snapshots/workloads/quantile-over-time-phase-0.json create mode 100644 crates/devtools/tests/sketch_plan_snapshots/workloads/quantile-phase-0-and-30s.json create mode 100644 crates/devtools/tests/sketch_plan_snapshots/workloads/quantile-two-targets.json create mode 100644 crates/devtools/tests/sketch_plan_snapshots/workloads/rollup-quantile-disjoint-labels.json create mode 100644 crates/devtools/tests/sketch_plan_snapshots/workloads/rollup-quantile-nested-labels.json create mode 100644 crates/devtools/tests/sketch_plan_snapshots/workloads/rollup-sum-chain.json create mode 100644 crates/devtools/tests/sketch_plan_snapshots/workloads/sign-non-negative.json create mode 100644 crates/devtools/tests/sketch_plan_snapshots/workloads/sign-unknown.json create mode 100644 crates/devtools/tests/sketch_plan_snapshots/workloads/sql-rollup-quantile-different-windows.json create mode 100644 crates/devtools/tests/sketch_plan_snapshots/workloads/sql-rollup-quantile-same-window.json create mode 100644 crates/devtools/tests/sketch_plan_snapshots/workloads/sql-table-data.tables.json create mode 100644 crates/devtools/tests/sketch_plan_snapshots/workloads/stddev-nested-labels.json create mode 100644 crates/devtools/tests/sketch_plan_snapshots/workloads/sum-5m-avg-10m-over-time.json create mode 100644 crates/devtools/tests/sketch_plan_snapshots/workloads/sum-avg-over-time-5m.json create mode 100644 crates/devtools/tests/sketch_plan_snapshots/workloads/sum-over-time-two-intervals.json create mode 100644 crates/devtools/tests/sketch_plan_snapshots/workloads/topk-5-and-10-accuracy.json create mode 100644 crates/devtools/tests/sketch_plan_snapshots/workloads/topk-5-and-10.json create mode 100644 crates/devtools/tests/sketch_plan_snapshots/workloads/topk-by-job-and-global.json create mode 100644 crates/devtools/tests/sketch_plan_snapshots/workloads/topk-rate-counter.json create mode 100644 crates/devtools/tests/sketch_plan_snapshots/workloads/topk-sum-count-over-time-accuracy.json create mode 100644 crates/devtools/tests/sketch_plan_snapshots/workloads/topk-sum-count-over-time.json diff --git a/crates/devtools/tests/sketch_plan_snapshots.rs b/crates/devtools/tests/sketch_plan_snapshots.rs index 278a223ae..4ea1554f6 100644 --- a/crates/devtools/tests/sketch_plan_snapshots.rs +++ b/crates/devtools/tests/sketch_plan_snapshots.rs @@ -9,6 +9,12 @@ //! sizes, sharing, timing, lifetime or cost shows up as a snapshot //! diff. //! +//! Small multi-query workloads (#1278) each exercise one planner behavior: +//! rollup across label sets, top-k reuse, chain widths and sharing, avg as +//! Sum / Count, and which sketches an accuracy target or a declared value +//! sign admits. Their `covers` line says what the workload exercises, not +//! which plan is selected. +//! //! `tests/sketch_plan_snapshots/manifest.json` lists each workload by id: //! its `workload` file relative to the repository root, SQL `tables`, //! `deployment` (the `asap_planner` arguments of its deployment diff --git a/crates/devtools/tests/sketch_plan_snapshots/avg-nested-labels-raw-retained.json b/crates/devtools/tests/sketch_plan_snapshots/avg-nested-labels-raw-retained.json new file mode 100644 index 000000000..d086213cb --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/avg-nested-labels-raw-retained.json @@ -0,0 +1,1095 @@ +{ + "accuracy_guarantees": "enforced", + "materialized_views": [], + "queries": [ + "avg by (job) (data)", + "avg by (job, host) (data)", + "avg (data)" + ], + "selected": { + "accepted": [ + { + "accepted_metric": null, + "sketches": [], + "summary": "accepted exact" + }, + { + "accepted_metric": null, + "sketches": [], + "summary": "accepted exact" + }, + { + "accepted_metric": null, + "sketches": [], + "summary": "accepted exact" + } + ], + "cost": { + "cost_per_second": 5.23892853776e-9, + "cpu_core_seconds_per_second": 0.000465905083333, + "per_node": { + "0": { + "cost_per_second": 1.08692000534e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 9.66666666667e-7, + "detail": "scan 10000 samples; x 0.0167/s; holds 48 bytes for 0.058 ms", + "multiplier": 1, + "operator": "Scan", + "timing": "query_time" + }, + "1": { + "cost_per_second": 2.06140001012e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.83333333333e-6, + "detail": "time range 15s: keep 10000 of 10000 rows; x 0.0167/s; holds 48 bytes for 0.110 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "2": { + "cost_per_second": 4.26428717448e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 3.7925e-6, + "detail": "hash aggregate 10000 rows into 10 groups: 20 ops per row, 15 group visits; x 0.0167/s; holds 400 bytes for 0.228 ms", + "multiplier": 1, + "operator": "Aggregate", + "timing": "query_time" + }, + "3": { + "cost_per_second": 1.38676000908e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.23333333333e-6, + "detail": "scan 10000 samples; x 0.0167/s; holds 64 bytes for 0.074 ms; keeps 640000 bytes of raw data on disk", + "multiplier": 1, + "operator": "Scan", + "timing": "query_time" + }, + "4": { + "cost_per_second": 2.0614000135e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.83333333333e-6, + "detail": "time range 15s: keep 10000 of 10000 rows; x 0.0167/s; holds 64 bytes for 0.110 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "5": { + "cost_per_second": 5.09382377852e-9, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.000453, + "detail": "hash aggregate 10000 rows into 10000 groups: 48 ops per row, 10000 group visits; x 0.0167/s; holds 560000 bytes for 27.180 ms", + "multiplier": 1, + "operator": "Aggregate", + "timing": "query_time" + }, + "6": { + "cost_per_second": 7.87080002576e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 7e-7, + "detail": "scan 10000 samples; x 0.0167/s; holds 32 bytes for 0.042 ms", + "multiplier": 1, + "operator": "Scan", + "timing": "query_time" + }, + "7": { + "cost_per_second": 2.06140000675e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.83333333333e-6, + "detail": "time range 15s: keep 10000 of 10000 rows; x 0.0167/s; holds 32 bytes for 0.110 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "8": { + "cost_per_second": 8.01228701967e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 7.12583333333e-7, + "detail": "hash aggregate 10000 rows into 1 groups: 4 ops per row, 2 group visits; x 0.0167/s; holds 24 bytes for 0.043 ms", + "multiplier": 1, + "operator": "Aggregate", + "timing": "query_time" + } + }, + "source": "analytical-cost-v2 (illustrative statistics)", + "usage": { + "average_memory_bytes": 253.681945835, + "cpu_ops_per_second": 463505.083333, + "disk_bytes": 640000, + "peak_cpu_cores": 3, + "peak_memory_bytes": 560712, + "scanned_bytes_per_second": 24000.0 + } + }, + "dag": { + "edges": [ + { + "consumer": 1, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 3, + 0 + ] + ] + }, + "producer": 0, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 2, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 3, + 0 + ] + ] + }, + "producer": 1, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 4, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "host", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 4, + 0 + ] + ] + }, + "producer": 3, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 5, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "host", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 4, + 0 + ] + ] + }, + "producer": 4, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 7, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 6, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 8, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 7, + "role": "Input", + "window": "NotApplicable" + } + ], + "nodes": [ + { + "id": 0, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 3, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Scan": { + "predicates": [], + "schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 3, + 0 + ] + ] + }, + "source": { + "TimeSeries": { + "metric": "data" + } + } + } + } + }, + "retention_ms": 15000 + }, + { + "id": 1, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 3, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "TimeRange": { + "child": 0, + "kind": "instant", + "range": { + "nanos": 0, + "secs": 15 + } + } + } + } + }, + { + "id": 2, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "avg", + "nullable": false + } + ], + "time_index": null, + "unique_keys": [ + [ + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Aggregate": { + "child": 1, + "filters": [], + "having": null, + "measures": [ + { + "col": null, + "kind": "avg" + } + ], + "output_names": [ + "" + ], + "reduction": { + "Reduce": [ + 2 + ] + } + } + } + } + }, + { + "id": 3, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "host", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 4, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Scan": { + "predicates": [], + "schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "host", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 4, + 0 + ] + ] + }, + "source": { + "TimeSeries": { + "metric": "data" + } + } + } + } + }, + "retention_ms": 15000 + }, + { + "id": 4, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "host", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 4, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "TimeRange": { + "child": 3, + "kind": "instant", + "range": { + "nanos": 0, + "secs": 15 + } + } + } + } + }, + { + "id": 5, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "utf8" + }, + "name": "host", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "avg", + "nullable": false + } + ], + "time_index": null, + "unique_keys": [ + [ + 0, + 1 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Aggregate": { + "child": 4, + "filters": [], + "having": null, + "measures": [ + { + "col": null, + "kind": "avg" + } + ], + "output_names": [ + "" + ], + "reduction": { + "Reduce": [ + 2, + 3 + ] + } + } + } + } + }, + { + "id": 6, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Scan": { + "predicates": [], + "schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "source": { + "TimeSeries": { + "metric": "data" + } + } + } + } + }, + "retention_ms": 15000 + }, + { + "id": 7, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "TimeRange": { + "child": 6, + "kind": "instant", + "range": { + "nanos": 0, + "secs": 15 + } + } + } + } + }, + { + "id": 8, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "float64" + }, + "name": "avg", + "nullable": false + } + ], + "time_index": null, + "unique_keys": [] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Aggregate": { + "child": 7, + "filters": [], + "having": null, + "measures": [ + { + "col": null, + "kind": "avg" + } + ], + "output_names": [ + "" + ], + "reduction": { + "Reduce": [] + } + } + } + } + } + ], + "roots": [ + 2, + 5, + 8 + ], + "scalar_roots": [] + } + } +} diff --git a/crates/devtools/tests/sketch_plan_snapshots/chains-10m-5m-3m-10s-mvp.json b/crates/devtools/tests/sketch_plan_snapshots/chains-10m-5m-3m-10s-mvp.json new file mode 100644 index 000000000..ad814d60d --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/chains-10m-5m-3m-10s-mvp.json @@ -0,0 +1,1791 @@ +{ + "accuracy_guarantees": "enforced", + "materialized_views": [ + { + "coverage": { + "definition_id": "bfbffb8f01ab202d585c3e18c9f78080", + "selection": [ + { + "columns": [] + } + ] + }, + "inputs": { + "materialized_views": [] + }, + "node_id": 1, + "refresh": "at_ingestion", + "retention_ms": 600000 + }, + { + "coverage": { + "definition_id": "bfbffb8f01ab202d585c3e18c9f78080", + "selection": [ + { + "columns": [] + } + ] + }, + "inputs": { + "materialized_views": [] + }, + "node_id": 10, + "refresh": "at_ingestion", + "retention_ms": 180000 + } + ], + "queries": [ + "quantile_over_time(0.5, data[10m])", + "quantile_over_time(0.9, data[5m])", + "quantile_over_time(0.99, data[3m])" + ], + "selected": { + "accepted": [ + { + "accepted_metric": "rank", + "sketches": [ + "Kll" + ], + "summary": "accepted rank (Kll)" + }, + { + "accepted_metric": "rank", + "sketches": [ + "Kll" + ], + "summary": "accepted rank (Kll)" + }, + { + "accepted_metric": "rank", + "sketches": [ + "Kll" + ], + "summary": "accepted rank (Kll)" + } + ], + "cost": { + "cost_per_second": 7.32192724727e-7, + "cpu_core_seconds_per_second": 0.0434410987333, + "per_node": { + "0": { + "cost_per_second": 3.14989416e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 2.8014e-6, + "detail": "scan 667 samples; x 1.0000/s", + "multiplier": 1, + "operator": "Scan", + "timing": "ingestion_time" + }, + "1": { + "cost_per_second": 3.99368299535e-8, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.000262089333333, + "detail": "build Kll in tumbling windows of 300000 ms for 10000 groups: 667 rows x 84 ops, 667 group visits, 33.3 states emitted; x 1.0000/s; keeps 32160000 bytes", + "multiplier": 1, + "operator": "SummaryTumblingWindowChain", + "timing": "ingestion_time" + }, + "10": { + "cost_per_second": 2.36416823438e-7, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.002678756, + "detail": "build Kll in tumbling windows of 10000 ms for 10000 groups: 667 rows x 84 ops, 667 group visits, 1000.0 states emitted; x 1.0000/s; keeps 179360000 bytes", + "multiplier": 1, + "operator": "SummaryTumblingWindowChain", + "timing": "ingestion_time" + }, + "11": { + "cost_per_second": 2.22631221498e-9, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.000198, + "detail": "time range 180s: 18 tumbling windows of states; x 0.1000/s; holds 944 bytes for 1.980 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "12": { + "cost_per_second": 4.03985179942e-7, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.0358896, + "detail": "merge 180000 states into 10000; x 0.1000/s; holds 10720000 bytes for 358.896 ms", + "multiplier": 1, + "operator": "SummaryMerge", + "timing": "query_time" + }, + "13": { + "cost_per_second": 3.82296e-8, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.0034, + "detail": "estimate 10000 groups x 1; x 0.1000/s", + "multiplier": 1, + "operator": "SummaryEstimate", + "timing": "query_time" + }, + "14": { + "cost_per_second": 1.12440000368e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1e-6, + "detail": "operator: pass 10000 rows; x 0.1000/s; holds 32 bytes for 0.010 ms", + "multiplier": 1, + "operator": "Project", + "timing": "query_time" + }, + "2": { + "cost_per_second": 4.1228004521e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 3.66666666667e-7, + "detail": "time range 300s: 1 tumbling windows of states; x 0.0033/s; holds 1072 bytes for 0.110 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "3": { + "cost_per_second": 4.12732098747e-10, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.0000366666666667, + "detail": "merge 10000 states into 10000; x 0.0033/s; holds 10720000 bytes for 11.000 ms", + "multiplier": 1, + "operator": "SummaryMerge", + "timing": "query_time" + }, + "4": { + "cost_per_second": 1.27432e-9, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.000113333333333, + "detail": "estimate 10000 groups x 1; x 0.0033/s", + "multiplier": 1, + "operator": "SummaryEstimate", + "timing": "query_time" + }, + "5": { + "cost_per_second": 3.74800001227e-13, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 3.33333333333e-8, + "detail": "operator: pass 10000 rows; x 0.0033/s; holds 32 bytes for 0.010 ms", + "multiplier": 1, + "operator": "Project", + "timing": "query_time" + }, + "6": { + "cost_per_second": 8.2456009042e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 7.33333333333e-7, + "detail": "time range 600s: 2 tumbling windows of states; x 0.0033/s; holds 1072 bytes for 0.220 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "7": { + "cost_per_second": 8.29439221679e-9, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.000736672, + "detail": "merge 20000 states into 10000; x 0.0033/s; holds 13280000 bytes for 221.002 ms", + "multiplier": 1, + "operator": "SummaryMerge", + "timing": "query_time" + }, + "8": { + "cost_per_second": 1.36067392e-9, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.000121013333333, + "detail": "estimate 10000 groups x 1; x 0.0033/s", + "multiplier": 1, + "operator": "SummaryEstimate", + "timing": "query_time" + }, + "9": { + "cost_per_second": 3.74800001227e-13, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 3.33333333333e-8, + "detail": "operator: pass 10000 rows; x 0.0033/s; holds 32 bytes for 0.010 ms", + "multiplier": 1, + "operator": "Project", + "timing": "query_time" + } + }, + "source": "analytical-cost-v2 (illustrative statistics)", + "usage": { + "average_memory_bytes": 211914912.771, + "cpu_ops_per_second": 43438964.3333, + "disk_bytes": 0, + "peak_cpu_cores": 4, + "peak_memory_bytes": 246243216, + "scanned_bytes_per_second": 21344.0 + } + }, + "dag": { + "edges": [ + { + "consumer": 1, + "data_state": { + "primitive": "Raw", + "timing": "ingestion_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 0, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 2, + "data_state": { + "primitive": "SummaryState", + "timing": "ingestion_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "window_end", + "nullable": false + }, + { + "dtype": { + "Sketch": "Kll" + }, + "name": "state", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 0, + 2 + ] + ] + }, + "producer": 1, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 3, + "data_state": { + "primitive": "SummaryState", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "window_end", + "nullable": false + }, + { + "dtype": { + "Sketch": "Kll" + }, + "name": "state", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 0, + 2 + ] + ] + }, + "producer": 2, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 4, + "data_state": { + "primitive": "SummaryState", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Sketch": "Kll" + }, + "name": "state", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 3, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 5, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "quantile", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 4, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 6, + "data_state": { + "primitive": "SummaryState", + "timing": "ingestion_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "window_end", + "nullable": false + }, + { + "dtype": { + "Sketch": "Kll" + }, + "name": "state", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 0, + 2 + ] + ] + }, + "producer": 1, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 7, + "data_state": { + "primitive": "SummaryState", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "window_end", + "nullable": false + }, + { + "dtype": { + "Sketch": "Kll" + }, + "name": "state", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 0, + 2 + ] + ] + }, + "producer": 6, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 8, + "data_state": { + "primitive": "SummaryState", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Sketch": "Kll" + }, + "name": "state", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 7, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 9, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "quantile", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 8, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 10, + "data_state": { + "primitive": "Raw", + "timing": "ingestion_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 0, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 11, + "data_state": { + "primitive": "SummaryState", + "timing": "ingestion_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "window_end", + "nullable": false + }, + { + "dtype": { + "Sketch": "Kll" + }, + "name": "state", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 0, + 2 + ] + ] + }, + "producer": 10, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 12, + "data_state": { + "primitive": "SummaryState", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "window_end", + "nullable": false + }, + { + "dtype": { + "Sketch": "Kll" + }, + "name": "state", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 0, + 2 + ] + ] + }, + "producer": 11, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 13, + "data_state": { + "primitive": "SummaryState", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Sketch": "Kll" + }, + "name": "state", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 12, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 14, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "quantile", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 13, + "role": "Input", + "window": "NotApplicable" + } + ], + "nodes": [ + { + "id": 0, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "ingestion_time" + }, + "payload": { + "NonASAP": { + "Scan": { + "predicates": [], + "schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "source": { + "TimeSeries": { + "metric": "data" + } + } + } + } + } + }, + { + "id": 1, + "lifetime": { + "AcrossEvaluations": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "window_end", + "nullable": false + }, + { + "dtype": { + "Sketch": "Kll" + }, + "name": "state", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 0, + 2 + ] + ] + }, + "output_state": { + "primitive": "SummaryState", + "timing": "ingestion_time" + }, + "parameters": { + "Kll": { + "k": 1404 + } + }, + "payload": { + "ASAP": { + "SummaryTumblingWindowChain": { + "child": 0, + "filter": null, + "input": { + "item": null, + "weight": { + "Column": "SampleValue" + } + }, + "reduction": "PerEntity", + "summary_type": { + "Sketch": "Kll" + }, + "tumbling_window_width_ms": 300000 + } + } + }, + "retention_ms": 600000, + "view_coverage": { + "definition_id": "bfbffb8f01ab202d585c3e18c9f78080", + "selection": [ + { + "columns": [] + } + ] + } + }, + { + "id": 2, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "window_end", + "nullable": false + }, + { + "dtype": { + "Sketch": "Kll" + }, + "name": "state", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 0, + 2 + ] + ] + }, + "output_state": { + "primitive": "SummaryState", + "timing": "query_time" + }, + "parameters": { + "Kll": { + "k": 1404 + } + }, + "payload": { + "NonASAP": { + "TimeRange": { + "child": 1, + "kind": "range", + "range": { + "nanos": 0, + "secs": 300 + } + } + } + } + }, + { + "id": 3, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Sketch": "Kll" + }, + "name": "state", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "SummaryState", + "timing": "query_time" + }, + "parameters": { + "Kll": { + "k": 1404 + } + }, + "payload": { + "ASAP": { + "SummaryMerge": { + "children": [ + 2 + ] + } + } + } + }, + { + "id": 4, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "quantile", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "ASAP": { + "SummaryEstimate": { + "query": { + "Quantile": { + "q": 0.9 + } + }, + "summary_input": 3 + } + } + } + }, + { + "id": 5, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Project": { + "child": 4, + "cols": [ + { + "alias": "ts", + "expr": { + "Column": 0 + } + }, + { + "alias": "value", + "expr": { + "Column": 1 + } + }, + { + "alias": "$promql_series_identity", + "expr": { + "Column": 2 + } + } + ] + } + } + } + }, + { + "id": 6, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "window_end", + "nullable": false + }, + { + "dtype": { + "Sketch": "Kll" + }, + "name": "state", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 0, + 2 + ] + ] + }, + "output_state": { + "primitive": "SummaryState", + "timing": "query_time" + }, + "parameters": { + "Kll": { + "k": 1404 + } + }, + "payload": { + "NonASAP": { + "TimeRange": { + "child": 1, + "kind": "range", + "range": { + "nanos": 0, + "secs": 600 + } + } + } + } + }, + { + "id": 7, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Sketch": "Kll" + }, + "name": "state", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "SummaryState", + "timing": "query_time" + }, + "parameters": { + "Kll": { + "k": 1404 + } + }, + "payload": { + "ASAP": { + "SummaryMerge": { + "children": [ + 6 + ] + } + } + } + }, + { + "id": 8, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "quantile", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "ASAP": { + "SummaryEstimate": { + "query": { + "Quantile": { + "q": 0.5 + } + }, + "summary_input": 7 + } + } + } + }, + { + "id": 9, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Project": { + "child": 8, + "cols": [ + { + "alias": "ts", + "expr": { + "Column": 0 + } + }, + { + "alias": "value", + "expr": { + "Column": 1 + } + }, + { + "alias": "$promql_series_identity", + "expr": { + "Column": 2 + } + } + ] + } + } + } + }, + { + "id": 10, + "lifetime": { + "AcrossEvaluations": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "window_end", + "nullable": false + }, + { + "dtype": { + "Sketch": "Kll" + }, + "name": "state", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 0, + 2 + ] + ] + }, + "output_state": { + "primitive": "SummaryState", + "timing": "ingestion_time" + }, + "parameters": { + "Kll": { + "k": 1404 + } + }, + "payload": { + "ASAP": { + "SummaryTumblingWindowChain": { + "child": 0, + "filter": null, + "input": { + "item": null, + "weight": { + "Column": "SampleValue" + } + }, + "reduction": "PerEntity", + "summary_type": { + "Sketch": "Kll" + }, + "tumbling_window_width_ms": 10000 + } + } + }, + "retention_ms": 180000, + "view_coverage": { + "definition_id": "bfbffb8f01ab202d585c3e18c9f78080", + "selection": [ + { + "columns": [] + } + ] + } + }, + { + "id": 11, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "window_end", + "nullable": false + }, + { + "dtype": { + "Sketch": "Kll" + }, + "name": "state", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 0, + 2 + ] + ] + }, + "output_state": { + "primitive": "SummaryState", + "timing": "query_time" + }, + "parameters": { + "Kll": { + "k": 1404 + } + }, + "payload": { + "NonASAP": { + "TimeRange": { + "child": 10, + "kind": "range", + "range": { + "nanos": 0, + "secs": 180 + } + } + } + } + }, + { + "id": 12, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Sketch": "Kll" + }, + "name": "state", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "SummaryState", + "timing": "query_time" + }, + "parameters": { + "Kll": { + "k": 1404 + } + }, + "payload": { + "ASAP": { + "SummaryMerge": { + "children": [ + 11 + ] + } + } + } + }, + { + "id": 13, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "quantile", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "ASAP": { + "SummaryEstimate": { + "query": { + "Quantile": { + "q": 0.99 + } + }, + "summary_input": 12 + } + } + } + }, + { + "id": 14, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Project": { + "child": 13, + "cols": [ + { + "alias": "ts", + "expr": { + "Column": 0 + } + }, + { + "alias": "value", + "expr": { + "Column": 1 + } + }, + { + "alias": "$promql_series_identity", + "expr": { + "Column": 2 + } + } + ] + } + } + } + } + ], + "roots": [ + 9, + 5, + 14 + ], + "scalar_roots": [] + } + } +} diff --git a/crates/devtools/tests/sketch_plan_snapshots/chains-10m-5m-3m-10s-raw-retained.json b/crates/devtools/tests/sketch_plan_snapshots/chains-10m-5m-3m-10s-raw-retained.json new file mode 100644 index 000000000..376b81f10 --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/chains-10m-5m-3m-10s-raw-retained.json @@ -0,0 +1,915 @@ +{ + "accuracy_guarantees": "enforced", + "materialized_views": [], + "queries": [ + "quantile_over_time(0.5, data[10m])", + "quantile_over_time(0.9, data[5m])", + "quantile_over_time(0.99, data[3m])" + ], + "selected": { + "accepted": [ + { + "accepted_metric": null, + "sketches": [], + "summary": "accepted exact" + }, + { + "accepted_metric": null, + "sketches": [], + "summary": "accepted exact" + }, + { + "accepted_metric": null, + "sketches": [], + "summary": "accepted exact" + } + ], + "cost": { + "cost_per_second": 6.55920011484e-8, + "cpu_core_seconds_per_second": 0.00583266666667, + "per_node": { + "0": { + "cost_per_second": 6.30488451447e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 5.6e-6, + "detail": "scan 400000 samples; x 0.0033/s; holds 12800000 bytes for 1.680 ms; keeps 12800000 bytes of raw data on disk", + "multiplier": 1, + "operator": "Scan", + "timing": "query_time" + }, + "1": { + "cost_per_second": 8.24560002699e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 7.33333333333e-6, + "detail": "time range 300s: keep 200000 of 400000 rows; x 0.0033/s; holds 32 bytes for 2.200 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "2": { + "cost_per_second": 2.54164308757e-9, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.000226, + "detail": "hash aggregate 200000 rows into 10000 groups: 44 ops per row, 200000 group visits; x 0.0033/s; holds 1920000 bytes for 67.800 ms", + "multiplier": 1, + "operator": "Aggregate", + "timing": "query_time" + }, + "3": { + "cost_per_second": 1.6491200054e-10, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.0000146666666667, + "detail": "time range 600s: keep 400000 of 400000 rows; x 0.0033/s; holds 32 bytes for 4.400 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "4": { + "cost_per_second": 4.2367649898e-9, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.000376666666667, + "detail": "hash aggregate 400000 rows into 10000 groups: 49 ops per row, 400000 group visits; x 0.0033/s; holds 3520000 bytes for 113.000 ms", + "multiplier": 1, + "operator": "Aggregate", + "timing": "query_time" + }, + "5": { + "cost_per_second": 5.66697601855e-10, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.0000504, + "detail": "scan 120000 samples; x 0.1000/s; holds 32 bytes for 0.504 ms", + "multiplier": 1, + "operator": "Scan", + "timing": "query_time" + }, + "6": { + "cost_per_second": 1.48420800486e-9, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.000132, + "detail": "time range 180s: keep 120000 of 120000 rows; x 0.1000/s; holds 32 bytes for 1.320 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "7": { + "cost_per_second": 5.64522706183e-8, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.00502, + "detail": "hash aggregate 120000 rows into 10000 groups: 40 ops per row, 120000 group visits; x 0.1000/s; holds 1280000 bytes for 50.200 ms", + "multiplier": 1, + "operator": "Aggregate", + "timing": "query_time" + } + }, + "source": "analytical-cost-v2 (illustrative statistics)", + "usage": { + "average_memory_bytes": 8257.07320747, + "cpu_ops_per_second": 5790000.0, + "disk_bytes": 12800000, + "peak_cpu_cores": 3, + "peak_memory_bytes": 19520128, + "scanned_bytes_per_second": 426666.666667 + } + }, + "dag": { + "edges": [ + { + "consumer": 1, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 0, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 2, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 1, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 3, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 0, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 4, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 3, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 6, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 5, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 7, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 6, + "role": "Input", + "window": "NotApplicable" + } + ], + "nodes": [ + { + "id": 0, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Scan": { + "predicates": [], + "schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "source": { + "TimeSeries": { + "metric": "data" + } + } + } + } + }, + "retention_ms": 600000 + }, + { + "id": 1, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "TimeRange": { + "child": 0, + "kind": "range", + "range": { + "nanos": 0, + "secs": 300 + } + } + } + } + }, + { + "id": 2, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Aggregate": { + "child": 1, + "filters": [], + "having": null, + "measures": [ + { + "col": null, + "kind": "quantile", + "q": 0.9 + } + ], + "output_names": [ + "" + ], + "reduction": "PerEntity" + } + } + } + }, + { + "id": 3, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "TimeRange": { + "child": 0, + "kind": "range", + "range": { + "nanos": 0, + "secs": 600 + } + } + } + } + }, + { + "id": 4, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Aggregate": { + "child": 3, + "filters": [], + "having": null, + "measures": [ + { + "col": null, + "kind": "quantile", + "q": 0.5 + } + ], + "output_names": [ + "" + ], + "reduction": "PerEntity" + } + } + } + }, + { + "id": 5, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Scan": { + "predicates": [], + "schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "source": { + "TimeSeries": { + "metric": "data" + } + } + } + } + }, + "retention_ms": 180000 + }, + { + "id": 6, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "TimeRange": { + "child": 5, + "kind": "range", + "range": { + "nanos": 0, + "secs": 180 + } + } + } + } + }, + { + "id": 7, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Aggregate": { + "child": 6, + "filters": [], + "having": null, + "measures": [ + { + "col": null, + "kind": "quantile", + "q": 0.99 + } + ], + "output_names": [ + "" + ], + "reduction": "PerEntity" + } + } + } + } + ], + "roots": [ + 4, + 2, + 7 + ], + "scalar_roots": [] + } + } +} diff --git a/crates/devtools/tests/sketch_plan_snapshots/chains-10m-5m-3m-3m-raw-retained.json b/crates/devtools/tests/sketch_plan_snapshots/chains-10m-5m-3m-3m-raw-retained.json new file mode 100644 index 000000000..bf3e73695 --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/chains-10m-5m-3m-3m-raw-retained.json @@ -0,0 +1,915 @@ +{ + "accuracy_guarantees": "enforced", + "materialized_views": [], + "queries": [ + "quantile_over_time(0.5, data[10m])", + "quantile_over_time(0.9, data[5m])", + "quantile_over_time(0.99, data[3m])" + ], + "selected": { + "accepted": [ + { + "accepted_metric": null, + "sketches": [], + "summary": "accepted exact" + }, + { + "accepted_metric": null, + "sketches": [], + "summary": "accepted exact" + }, + { + "accepted_metric": null, + "sketches": [], + "summary": "accepted exact" + } + ], + "cost": { + "cost_per_second": 1.03390013803e-8, + "cpu_core_seconds_per_second": 0.000919288888889, + "per_node": { + "0": { + "cost_per_second": 6.30488451447e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 5.6e-6, + "detail": "scan 400000 samples; x 0.0033/s; holds 12800000 bytes for 1.680 ms; keeps 12800000 bytes of raw data on disk", + "multiplier": 1, + "operator": "Scan", + "timing": "query_time" + }, + "1": { + "cost_per_second": 8.24560002699e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 7.33333333333e-6, + "detail": "time range 300s: keep 200000 of 400000 rows; x 0.0033/s; holds 32 bytes for 2.200 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "2": { + "cost_per_second": 2.54164308757e-9, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.000226, + "detail": "hash aggregate 200000 rows into 10000 groups: 44 ops per row, 200000 group visits; x 0.0033/s; holds 1920000 bytes for 67.800 ms", + "multiplier": 1, + "operator": "Aggregate", + "timing": "query_time" + }, + "3": { + "cost_per_second": 1.6491200054e-10, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.0000146666666667, + "detail": "time range 600s: keep 400000 of 400000 rows; x 0.0033/s; holds 32 bytes for 4.400 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "4": { + "cost_per_second": 4.2367649898e-9, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.000376666666667, + "detail": "hash aggregate 400000 rows into 10000 groups: 49 ops per row, 400000 group visits; x 0.0033/s; holds 3520000 bytes for 113.000 ms", + "multiplier": 1, + "operator": "Aggregate", + "timing": "query_time" + }, + "5": { + "cost_per_second": 3.14832001031e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 2.8e-6, + "detail": "scan 120000 samples; x 0.0056/s; holds 32 bytes for 0.504 ms", + "multiplier": 1, + "operator": "Scan", + "timing": "query_time" + }, + "6": { + "cost_per_second": 8.24560002699e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 7.33333333333e-6, + "detail": "time range 180s: keep 120000 of 120000 rows; x 0.0056/s; holds 32 bytes for 1.320 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "7": { + "cost_per_second": 3.13623725657e-9, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.000278888888889, + "detail": "hash aggregate 120000 rows into 10000 groups: 40 ops per row, 120000 group visits; x 0.0056/s; holds 1280000 bytes for 50.200 ms", + "multiplier": 1, + "operator": "Aggregate", + "timing": "query_time" + } + }, + "source": "analytical-cost-v2 (illustrative statistics)", + "usage": { + "average_memory_bytes": 2188.44547271, + "cpu_ops_per_second": 912888.888889, + "disk_bytes": 12800000, + "peak_cpu_cores": 3, + "peak_memory_bytes": 19520128, + "scanned_bytes_per_second": 64000.0 + } + }, + "dag": { + "edges": [ + { + "consumer": 1, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 0, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 2, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 1, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 3, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 0, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 4, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 3, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 6, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 5, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 7, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 6, + "role": "Input", + "window": "NotApplicable" + } + ], + "nodes": [ + { + "id": 0, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Scan": { + "predicates": [], + "schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "source": { + "TimeSeries": { + "metric": "data" + } + } + } + } + }, + "retention_ms": 600000 + }, + { + "id": 1, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "TimeRange": { + "child": 0, + "kind": "range", + "range": { + "nanos": 0, + "secs": 300 + } + } + } + } + }, + { + "id": 2, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Aggregate": { + "child": 1, + "filters": [], + "having": null, + "measures": [ + { + "col": null, + "kind": "quantile", + "q": 0.9 + } + ], + "output_names": [ + "" + ], + "reduction": "PerEntity" + } + } + } + }, + { + "id": 3, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "TimeRange": { + "child": 0, + "kind": "range", + "range": { + "nanos": 0, + "secs": 600 + } + } + } + } + }, + { + "id": 4, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Aggregate": { + "child": 3, + "filters": [], + "having": null, + "measures": [ + { + "col": null, + "kind": "quantile", + "q": 0.5 + } + ], + "output_names": [ + "" + ], + "reduction": "PerEntity" + } + } + } + }, + { + "id": 5, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Scan": { + "predicates": [], + "schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "source": { + "TimeSeries": { + "metric": "data" + } + } + } + } + }, + "retention_ms": 180000 + }, + { + "id": 6, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "TimeRange": { + "child": 5, + "kind": "range", + "range": { + "nanos": 0, + "secs": 180 + } + } + } + } + }, + { + "id": 7, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Aggregate": { + "child": 6, + "filters": [], + "having": null, + "measures": [ + { + "col": null, + "kind": "quantile", + "q": 0.99 + } + ], + "output_names": [ + "" + ], + "reduction": "PerEntity" + } + } + } + } + ], + "roots": [ + 4, + 2, + 7 + ], + "scalar_roots": [] + } + } +} diff --git a/crates/devtools/tests/sketch_plan_snapshots/distinct-over-time-1pct-raw-retained.json b/crates/devtools/tests/sketch_plan_snapshots/distinct-over-time-1pct-raw-retained.json new file mode 100644 index 000000000..e403fe5e1 --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/distinct-over-time-1pct-raw-retained.json @@ -0,0 +1,588 @@ +{ + "accuracy_guarantees": "enforced", + "materialized_views": [], + "queries": [ + "distinct_over_time(data[10m])", + "distinct_over_time(data[5m])" + ], + "selected": { + "accepted": [ + { + "accepted_metric": null, + "sketches": [], + "summary": "accepted exact" + }, + { + "accepted_metric": null, + "sketches": [], + "summary": "accepted exact" + } + ], + "cost": { + "cost_per_second": 2.00759534207e-8, + "cpu_core_seconds_per_second": 0.00178493333333, + "per_node": { + "0": { + "cost_per_second": 6.30488451447e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 5.6e-6, + "detail": "scan 400000 samples; x 0.0033/s; holds 12800000 bytes for 1.680 ms; keeps 12800000 bytes of raw data on disk", + "multiplier": 1, + "operator": "Scan", + "timing": "query_time" + }, + "1": { + "cost_per_second": 8.24560002699e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 7.33333333333e-6, + "detail": "time range 300s: keep 200000 of 400000 rows; x 0.0033/s; holds 32 bytes for 2.200 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "2": { + "cost_per_second": 6.32036909387e-9, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.000562, + "detail": "hash aggregate 200000 rows into 10000 groups: 547 ops per row, 200000 group visits; x 0.0033/s; holds 1920000 bytes for 168.600 ms", + "multiplier": 1, + "operator": "Aggregate", + "timing": "query_time" + }, + "3": { + "cost_per_second": 1.6491200054e-10, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.0000146666666667, + "detail": "time range 600s: keep 400000 of 400000 rows; x 0.0033/s; holds 32 bytes for 4.400 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "4": { + "cost_per_second": 1.34451674809e-8, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.00119533333333, + "detail": "hash aggregate 400000 rows into 10000 groups: 664 ops per row, 400000 group visits; x 0.0033/s; holds 3520000 bytes for 358.600 ms", + "multiplier": 1, + "operator": "Aggregate", + "timing": "query_time" + } + }, + "source": "analytical-cost-v2 (illustrative statistics)", + "usage": { + "average_memory_bytes": 5358.29403733, + "cpu_ops_per_second": 1780666.66667, + "disk_bytes": 12800000, + "peak_cpu_cores": 2, + "peak_memory_bytes": 18240064, + "scanned_bytes_per_second": 42666.6666667 + } + }, + "dag": { + "edges": [ + { + "consumer": 1, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 0, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 2, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 1, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 3, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 0, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 4, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 3, + "role": "Input", + "window": "NotApplicable" + } + ], + "nodes": [ + { + "id": 0, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Scan": { + "predicates": [], + "schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "source": { + "TimeSeries": { + "metric": "data" + } + } + } + } + }, + "retention_ms": 600000 + }, + { + "id": 1, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "TimeRange": { + "child": 0, + "kind": "range", + "range": { + "nanos": 0, + "secs": 300 + } + } + } + } + }, + { + "id": 2, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Aggregate": { + "child": 1, + "filters": [], + "having": null, + "measures": [ + { + "cols": [], + "kind": "cardinality" + } + ], + "output_names": [ + "" + ], + "reduction": "PerEntity" + } + } + } + }, + { + "id": 3, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "TimeRange": { + "child": 0, + "kind": "range", + "range": { + "nanos": 0, + "secs": 600 + } + } + } + } + }, + { + "id": 4, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Aggregate": { + "child": 3, + "filters": [], + "having": null, + "measures": [ + { + "cols": [], + "kind": "cardinality" + } + ], + "output_names": [ + "" + ], + "reduction": "PerEntity" + } + } + } + } + ], + "roots": [ + 4, + 2 + ], + "scalar_roots": [] + } + } +} diff --git a/crates/devtools/tests/sketch_plan_snapshots/distinct-over-time-5pct-raw-retained.json b/crates/devtools/tests/sketch_plan_snapshots/distinct-over-time-5pct-raw-retained.json new file mode 100644 index 000000000..3a783615c --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/distinct-over-time-5pct-raw-retained.json @@ -0,0 +1,1156 @@ +{ + "accuracy_guarantees": "enforced", + "materialized_views": [], + "queries": [ + "distinct_over_time(data[10m])", + "distinct_over_time(data[5m])" + ], + "selected": { + "accepted": [ + { + "accepted_metric": "relative", + "sketches": [ + "Kmv" + ], + "summary": "accepted relative (Kmv)" + }, + { + "accepted_metric": "relative", + "sketches": [ + "Kmv" + ], + "summary": "accepted relative (Kmv)" + } + ], + "cost": { + "cost_per_second": 9.1390148533e-9, + "cpu_core_seconds_per_second": 0.000807966666667, + "per_node": { + "0": { + "cost_per_second": 6.29664002061e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 5.6e-6, + "detail": "scan 400000 samples; x 0.0033/s; holds 32 bytes for 1.680 ms; keeps 12800000 bytes of raw data on disk", + "multiplier": 1, + "operator": "Scan", + "timing": "query_time" + }, + "1": { + "cost_per_second": 5.43842958488e-9, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.0004796, + "detail": "build Kmv in tumbling windows of 300000 ms for 10000 groups: 400000 rows x 116.2 ops, 400000 group visits, 10000.0 states emitted; x 0.0033/s; holds 83040000 bytes for 143.880 ms", + "multiplier": 1, + "operator": "SummaryTumblingWindowChain", + "timing": "query_time" + }, + "2": { + "cost_per_second": 4.12280350208e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 3.66666666667e-7, + "detail": "time range 300s: 1 tumbling windows of states; x 0.0033/s; holds 8304 bytes for 0.110 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "3": { + "cost_per_second": 4.15782078354e-10, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.0000366666666667, + "detail": "merge 10000 states into 10000; x 0.0033/s; holds 83040000 bytes for 11.000 ms", + "multiplier": 1, + "operator": "SummaryMerge", + "timing": "query_time" + }, + "4": { + "cost_per_second": 1.3118e-9, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.000116666666667, + "detail": "estimate 10000 groups x 1; x 0.0033/s", + "multiplier": 1, + "operator": "SummaryEstimate", + "timing": "query_time" + }, + "5": { + "cost_per_second": 3.74800001227e-13, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 3.33333333333e-8, + "detail": "operator: pass 10000 rows; x 0.0033/s; holds 32 bytes for 0.010 ms", + "multiplier": 1, + "operator": "Project", + "timing": "query_time" + }, + "6": { + "cost_per_second": 8.24560700416e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 7.33333333333e-7, + "detail": "time range 600s: 2 tumbling windows of states; x 0.0033/s; holds 8304 bytes for 0.220 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "7": { + "cost_per_second": 5.85118779357e-10, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.0000516, + "detail": "merge 20000 states into 10000; x 0.0033/s; holds 83040000 bytes for 15.480 ms", + "multiplier": 1, + "operator": "SummaryMerge", + "timing": "query_time" + }, + "8": { + "cost_per_second": 1.3118e-9, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.000116666666667, + "detail": "estimate 10000 groups x 1; x 0.0033/s", + "multiplier": 1, + "operator": "SummaryEstimate", + "timing": "query_time" + }, + "9": { + "cost_per_second": 3.74800001227e-13, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 3.33333333333e-8, + "detail": "operator: pass 10000 rows; x 0.0033/s; holds 32 bytes for 0.010 ms", + "multiplier": 1, + "operator": "Project", + "timing": "query_time" + } + }, + "source": "analytical-cost-v2 (illustrative statistics)", + "usage": { + "average_memory_bytes": 47155.6573157, + "cpu_ops_per_second": 803700.0, + "disk_bytes": 12800000, + "peak_cpu_cores": 2, + "peak_memory_bytes": 249136704, + "scanned_bytes_per_second": 42666.6666667 + } + }, + "dag": { + "edges": [ + { + "consumer": 1, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 0, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 2, + "data_state": { + "primitive": "SummaryState", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "window_end", + "nullable": false + }, + { + "dtype": { + "Sketch": "Kmv" + }, + "name": "state", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 0, + 2 + ] + ] + }, + "producer": 1, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 3, + "data_state": { + "primitive": "SummaryState", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "window_end", + "nullable": false + }, + { + "dtype": { + "Sketch": "Kmv" + }, + "name": "state", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 0, + 2 + ] + ] + }, + "producer": 2, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 4, + "data_state": { + "primitive": "SummaryState", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Sketch": "Kmv" + }, + "name": "state", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 3, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 5, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "cardinality", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 4, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 6, + "data_state": { + "primitive": "SummaryState", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "window_end", + "nullable": false + }, + { + "dtype": { + "Sketch": "Kmv" + }, + "name": "state", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 0, + 2 + ] + ] + }, + "producer": 1, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 7, + "data_state": { + "primitive": "SummaryState", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "window_end", + "nullable": false + }, + { + "dtype": { + "Sketch": "Kmv" + }, + "name": "state", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 0, + 2 + ] + ] + }, + "producer": 6, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 8, + "data_state": { + "primitive": "SummaryState", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Sketch": "Kmv" + }, + "name": "state", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 7, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 9, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "cardinality", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 8, + "role": "Input", + "window": "NotApplicable" + } + ], + "nodes": [ + { + "id": 0, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Scan": { + "predicates": [], + "schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "source": { + "TimeSeries": { + "metric": "data" + } + } + } + } + }, + "retention_ms": 600000 + }, + { + "id": 1, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "window_end", + "nullable": false + }, + { + "dtype": { + "Sketch": "Kmv" + }, + "name": "state", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 0, + 2 + ] + ] + }, + "output_state": { + "primitive": "SummaryState", + "timing": "query_time" + }, + "parameters": { + "Kmv": { + "k": 106263 + } + }, + "payload": { + "ASAP": { + "SummaryTumblingWindowChain": { + "child": 0, + "filter": null, + "input": { + "item": null, + "weight": { + "Column": "SampleValue" + } + }, + "reduction": "PerEntity", + "summary_type": { + "Sketch": "Kmv" + }, + "tumbling_window_width_ms": 300000 + } + } + } + }, + { + "id": 2, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "window_end", + "nullable": false + }, + { + "dtype": { + "Sketch": "Kmv" + }, + "name": "state", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 0, + 2 + ] + ] + }, + "output_state": { + "primitive": "SummaryState", + "timing": "query_time" + }, + "parameters": { + "Kmv": { + "k": 106263 + } + }, + "payload": { + "NonASAP": { + "TimeRange": { + "child": 1, + "kind": "range", + "range": { + "nanos": 0, + "secs": 300 + } + } + } + } + }, + { + "id": 3, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Sketch": "Kmv" + }, + "name": "state", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "SummaryState", + "timing": "query_time" + }, + "parameters": { + "Kmv": { + "k": 106263 + } + }, + "payload": { + "ASAP": { + "SummaryMerge": { + "children": [ + 2 + ] + } + } + } + }, + { + "id": 4, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "cardinality", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "ASAP": { + "SummaryEstimate": { + "query": "Cardinality", + "summary_input": 3 + } + } + } + }, + { + "id": 5, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Project": { + "child": 4, + "cols": [ + { + "alias": "ts", + "expr": { + "Column": 0 + } + }, + { + "alias": "value", + "expr": { + "Column": 1 + } + }, + { + "alias": "$promql_series_identity", + "expr": { + "Column": 2 + } + } + ] + } + } + } + }, + { + "id": 6, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "window_end", + "nullable": false + }, + { + "dtype": { + "Sketch": "Kmv" + }, + "name": "state", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 0, + 2 + ] + ] + }, + "output_state": { + "primitive": "SummaryState", + "timing": "query_time" + }, + "parameters": { + "Kmv": { + "k": 106263 + } + }, + "payload": { + "NonASAP": { + "TimeRange": { + "child": 1, + "kind": "range", + "range": { + "nanos": 0, + "secs": 600 + } + } + } + } + }, + { + "id": 7, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Sketch": "Kmv" + }, + "name": "state", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "SummaryState", + "timing": "query_time" + }, + "parameters": { + "Kmv": { + "k": 106263 + } + }, + "payload": { + "ASAP": { + "SummaryMerge": { + "children": [ + 6 + ] + } + } + } + }, + { + "id": 8, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "cardinality", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "ASAP": { + "SummaryEstimate": { + "query": "Cardinality", + "summary_input": 7 + } + } + } + }, + { + "id": 9, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Project": { + "child": 8, + "cols": [ + { + "alias": "ts", + "expr": { + "Column": 0 + } + }, + { + "alias": "value", + "expr": { + "Column": 1 + } + }, + { + "alias": "$promql_series_identity", + "expr": { + "Column": 2 + } + } + ] + } + } + } + } + ], + "roots": [ + 9, + 5 + ], + "scalar_roots": [] + } + } +} diff --git a/crates/devtools/tests/sketch_plan_snapshots/distinct-two-forms-raw-retained.json b/crates/devtools/tests/sketch_plan_snapshots/distinct-two-forms-raw-retained.json new file mode 100644 index 000000000..4e1a1e550 --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/distinct-two-forms-raw-retained.json @@ -0,0 +1,892 @@ +{ + "accuracy_guarantees": "enforced", + "materialized_views": [], + "queries": [ + "distinct_over_time(data[5m])", + "count(count_values(\"v\", data))" + ], + "selected": { + "accepted": [ + { + "accepted_metric": "relative", + "sketches": [ + "Kmv" + ], + "summary": "accepted relative (Kmv)" + }, + { + "accepted_metric": null, + "sketches": [], + "summary": "accepted exact" + } + ], + "cost": { + "cost_per_second": 1.80470290396e-8, + "cpu_core_seconds_per_second": 0.00159692354113, + "per_node": { + "0": { + "cost_per_second": 1.57519056431e-10, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.000014, + "detail": "scan 200000 samples; x 0.0167/s; holds 6400000 bytes for 0.840 ms; keeps 6400000 bytes of raw data on disk", + "multiplier": 1, + "operator": "Scan", + "timing": "query_time" + }, + "1": { + "cost_per_second": 2.06140000675e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.83333333333e-6, + "detail": "time range 15s: keep 10000 of 200000 rows; x 0.0167/s; holds 32 bytes for 0.110 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "2": { + "cost_per_second": 7.73502871899e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 6.87925e-6, + "detail": "hash aggregate 10000 rows into 1 groups: 41 ops per row, 2 group visits; x 0.0167/s; holds 24 bytes for 0.413 ms", + "multiplier": 1, + "operator": "Aggregate", + "timing": "query_time" + }, + "3": { + "cost_per_second": 5.0110760123e-13, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 4.45666666667e-8, + "detail": "hash aggregate 1 rows into 1 groups: 4 ops per row, 1 group visits; x 0.0167/s; holds 24 bytes for 0.003 ms", + "multiplier": 1, + "operator": "Aggregate", + "timing": "query_time" + }, + "4": { + "cost_per_second": 4.1228000135e-10, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.0000366666666667, + "detail": "time range 300s: keep 200000 of 200000 rows; x 0.0167/s; holds 32 bytes for 2.200 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "5": { + "cost_per_second": 1.08178905869e-8, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.000953999724464, + "detail": "build Kmv into 10000 states: 200000 rows x 116.19991733920547 ops, 200000 group visits; x 0.0167/s; holds 83040000 bytes for 57.240 ms", + "multiplier": 1, + "operator": "SummaryAgg", + "timing": "query_time" + }, + "6": { + "cost_per_second": 6.559e-9, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.000583333333333, + "detail": "estimate 10000 groups x 1; x 0.0167/s", + "multiplier": 1, + "operator": "SummaryEstimate", + "timing": "query_time" + }, + "7": { + "cost_per_second": 1.87400000613e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-7, + "detail": "operator: pass 10000 rows; x 0.0167/s; holds 32 bytes for 0.010 ms", + "multiplier": 1, + "operator": "Project", + "timing": "query_time" + } + }, + "source": "analytical-cost-v2 (illustrative statistics)", + "usage": { + "average_memory_bytes": 79309.738523, + "cpu_ops_per_second": 1586256.87446, + "disk_bytes": 6400000, + "peak_cpu_cores": 2, + "peak_memory_bytes": 89440144, + "scanned_bytes_per_second": 106666.666667 + } + }, + "dag": { + "edges": [ + { + "consumer": 1, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 0, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 2, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 1, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 3, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "utf8" + }, + "name": "v", + "nullable": false + }, + { + "dtype": { + "Plain": "int64" + }, + "name": "count", + "nullable": false + } + ], + "time_index": null, + "unique_keys": [] + }, + "producer": 2, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 4, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 0, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 5, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 4, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 6, + "data_state": { + "primitive": "SummaryState", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Sketch": "Kmv" + }, + "name": "state", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 5, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 7, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "cardinality", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 6, + "role": "Input", + "window": "NotApplicable" + } + ], + "nodes": [ + { + "id": 0, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Scan": { + "predicates": [], + "schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "source": { + "TimeSeries": { + "metric": "data" + } + } + } + } + }, + "retention_ms": 300000 + }, + { + "id": 1, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "TimeRange": { + "child": 0, + "kind": "instant", + "range": { + "nanos": 0, + "secs": 15 + } + } + } + } + }, + { + "id": 2, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "utf8" + }, + "name": "v", + "nullable": false + }, + { + "dtype": { + "Plain": "int64" + }, + "name": "count", + "nullable": false + } + ], + "time_index": null, + "unique_keys": [] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Aggregate": { + "child": 1, + "filters": [], + "having": null, + "measures": [ + { + "kind": "count_values", + "label": "v" + } + ], + "output_names": [ + "" + ], + "reduction": { + "Reduce": [] + } + } + } + } + }, + { + "id": 3, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "int64" + }, + "name": "count", + "nullable": false + } + ], + "time_index": null, + "unique_keys": [] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Aggregate": { + "child": 2, + "filters": [], + "having": null, + "measures": [ + { + "kind": "count" + } + ], + "output_names": [ + "" + ], + "reduction": { + "Reduce": [] + } + } + } + } + }, + { + "id": 4, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "TimeRange": { + "child": 0, + "kind": "range", + "range": { + "nanos": 0, + "secs": 300 + } + } + } + } + }, + { + "id": 5, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Sketch": "Kmv" + }, + "name": "state", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "SummaryState", + "timing": "query_time" + }, + "parameters": { + "Kmv": { + "k": 106263 + } + }, + "payload": { + "ASAP": { + "SummaryAgg": { + "child": 4, + "filter": null, + "input": { + "item": null, + "weight": { + "Column": "SampleValue" + } + }, + "reduction": "PerEntity", + "summary_type": { + "Sketch": "Kmv" + } + } + } + } + }, + { + "id": 6, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "cardinality", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "ASAP": { + "SummaryEstimate": { + "query": "Cardinality", + "summary_input": 5 + } + } + } + }, + { + "id": 7, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Project": { + "child": 6, + "cols": [ + { + "alias": "ts", + "expr": { + "Column": 0 + } + }, + { + "alias": "value", + "expr": { + "Column": 1 + } + }, + { + "alias": "$promql_series_identity", + "expr": { + "Column": 2 + } + } + ] + } + } + } + } + ], + "roots": [ + 7, + 3 + ], + "scalar_roots": [] + } + } +} diff --git a/crates/devtools/tests/sketch_plan_snapshots/entropy-and-distinct-raw-retained.json b/crates/devtools/tests/sketch_plan_snapshots/entropy-and-distinct-raw-retained.json new file mode 100644 index 000000000..e7654186a --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/entropy-and-distinct-raw-retained.json @@ -0,0 +1,711 @@ +{ + "accuracy_guarantees": "enforced", + "materialized_views": [], + "queries": [ + "entropy_over_time(data[5m])", + "distinct_over_time(data[5m])" + ], + "selected": { + "accepted": [ + { + "accepted_metric": null, + "sketches": [], + "summary": "accepted exact" + }, + { + "accepted_metric": "relative", + "sketches": [ + "Kmv" + ], + "summary": "accepted relative (Kmv)" + } + ], + "cost": { + "cost_per_second": 4.9550579091e-8, + "cpu_core_seconds_per_second": 0.00439816666667, + "per_node": { + "0": { + "cost_per_second": 1.57416000515e-10, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.000014, + "detail": "scan 200000 samples; x 0.0167/s; holds 32 bytes for 0.840 ms; keeps 6400000 bytes of raw data on disk", + "multiplier": 1, + "operator": "Scan", + "timing": "query_time" + }, + "1": { + "cost_per_second": 4.125499097e-10, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.0000366666666667, + "detail": "time range 300s: keep 200000 of 200000 rows; x 0.0167/s; holds 6400000 bytes for 2.200 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "2": { + "cost_per_second": 1.08178937114e-8, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.000954, + "detail": "build Kmv into 10000 states: 200000 rows x 116.2 ops, 200000 group visits; x 0.0167/s; holds 83040000 bytes for 57.240 ms", + "multiplier": 1, + "operator": "SummaryAgg", + "timing": "query_time" + }, + "3": { + "cost_per_second": 6.559e-9, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.000583333333333, + "detail": "estimate 10000 groups x 1; x 0.0167/s", + "multiplier": 1, + "operator": "SummaryEstimate", + "timing": "query_time" + }, + "4": { + "cost_per_second": 1.87400000613e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-7, + "detail": "operator: pass 10000 rows; x 0.0167/s; holds 32 bytes for 0.010 ms", + "multiplier": 1, + "operator": "Project", + "timing": "query_time" + }, + "5": { + "cost_per_second": 3.16018454694e-8, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.00281, + "detail": "hash aggregate 200000 rows into 10000 groups: 547 ops per row, 200000 group visits; x 0.0167/s; holds 1920000 bytes for 168.600 ms", + "multiplier": 1, + "operator": "Aggregate", + "timing": "query_time" + } + }, + "source": "analytical-cost-v2 (illustrative statistics)", + "usage": { + "average_memory_bytes": 84850.02712, + "cpu_ops_per_second": 4387500.0, + "disk_bytes": 6400000, + "peak_cpu_cores": 2, + "peak_memory_bytes": 91360064, + "scanned_bytes_per_second": 106666.666667 + } + }, + "dag": { + "edges": [ + { + "consumer": 1, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 0, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 2, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 1, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 3, + "data_state": { + "primitive": "SummaryState", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Sketch": "Kmv" + }, + "name": "state", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 2, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 4, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "cardinality", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 3, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 5, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 1, + "role": "Input", + "window": "NotApplicable" + } + ], + "nodes": [ + { + "id": 0, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Scan": { + "predicates": [], + "schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "source": { + "TimeSeries": { + "metric": "data" + } + } + } + } + }, + "retention_ms": 300000 + }, + { + "id": 1, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "TimeRange": { + "child": 0, + "kind": "range", + "range": { + "nanos": 0, + "secs": 300 + } + } + } + } + }, + { + "id": 2, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Sketch": "Kmv" + }, + "name": "state", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "SummaryState", + "timing": "query_time" + }, + "parameters": { + "Kmv": { + "k": 26656 + } + }, + "payload": { + "ASAP": { + "SummaryAgg": { + "child": 1, + "filter": null, + "input": { + "item": null, + "weight": { + "Column": "SampleValue" + } + }, + "reduction": "PerEntity", + "summary_type": { + "Sketch": "Kmv" + } + } + } + } + }, + { + "id": 3, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "cardinality", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "ASAP": { + "SummaryEstimate": { + "query": "Cardinality", + "summary_input": 2 + } + } + } + }, + { + "id": 4, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Project": { + "child": 3, + "cols": [ + { + "alias": "ts", + "expr": { + "Column": 0 + } + }, + { + "alias": "value", + "expr": { + "Column": 1 + } + }, + { + "alias": "$promql_series_identity", + "expr": { + "Column": 2 + } + } + ] + } + } + } + }, + { + "id": 5, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Aggregate": { + "child": 1, + "filters": [], + "having": null, + "measures": [ + { + "col": null, + "kind": "frequency_entropy" + } + ], + "output_names": [ + "" + ], + "reduction": "PerEntity" + } + } + } + } + ], + "roots": [ + 5, + 4 + ], + "scalar_roots": [] + } + } +} diff --git a/crates/devtools/tests/sketch_plan_snapshots/entropy-over-time-raw-retained.json b/crates/devtools/tests/sketch_plan_snapshots/entropy-over-time-raw-retained.json new file mode 100644 index 000000000..718890ee3 --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/entropy-over-time-raw-retained.json @@ -0,0 +1,358 @@ +{ + "accuracy_guarantees": "enforced", + "materialized_views": [], + "queries": [ + "entropy_over_time(data[5m])" + ], + "selected": { + "accepted": [ + { + "accepted_metric": null, + "sketches": [], + "summary": "accepted exact" + } + ], + "cost": { + "cost_per_second": 3.21715414712e-8, + "cpu_core_seconds_per_second": 0.00286066666667, + "per_node": { + "0": { + "cost_per_second": 1.57416000515e-10, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.000014, + "detail": "scan 200000 samples; x 0.0167/s; holds 32 bytes for 0.840 ms; keeps 6400000 bytes of raw data on disk", + "multiplier": 1, + "operator": "Scan", + "timing": "query_time" + }, + "1": { + "cost_per_second": 4.1228000135e-10, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.0000366666666667, + "detail": "time range 300s: keep 200000 of 200000 rows; x 0.0167/s; holds 32 bytes for 2.200 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "2": { + "cost_per_second": 3.16018454694e-8, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.00281, + "detail": "hash aggregate 200000 rows into 10000 groups: 547 ops per row, 200000 group visits; x 0.0167/s; holds 1920000 bytes for 168.600 ms", + "multiplier": 1, + "operator": "Aggregate", + "timing": "query_time" + } + }, + "source": "analytical-cost-v2 (illustrative statistics)", + "usage": { + "average_memory_bytes": 5395.20162133, + "cpu_ops_per_second": 2850000.0, + "disk_bytes": 6400000, + "peak_cpu_cores": 1, + "peak_memory_bytes": 1920064, + "scanned_bytes_per_second": 106666.666667 + } + }, + "dag": { + "edges": [ + { + "consumer": 1, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 0, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 2, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 1, + "role": "Input", + "window": "NotApplicable" + } + ], + "nodes": [ + { + "id": 0, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Scan": { + "predicates": [], + "schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "source": { + "TimeSeries": { + "metric": "data" + } + } + } + } + }, + "retention_ms": 300000 + }, + { + "id": 1, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "TimeRange": { + "child": 0, + "kind": "range", + "range": { + "nanos": 0, + "secs": 300 + } + } + } + } + }, + { + "id": 2, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Aggregate": { + "child": 1, + "filters": [], + "having": null, + "measures": [ + { + "col": null, + "kind": "frequency_entropy" + } + ], + "output_names": [ + "" + ], + "reduction": "PerEntity" + } + } + } + } + ], + "roots": [ + 2 + ], + "scalar_roots": [] + } + } +} diff --git a/crates/devtools/tests/sketch_plan_snapshots/manifest.json b/crates/devtools/tests/sketch_plan_snapshots/manifest.json index f6f57e28a..f5fb82cba 100644 --- a/crates/devtools/tests/sketch_plan_snapshots/manifest.json +++ b/crates/devtools/tests/sketch_plan_snapshots/manifest.json @@ -74,6 +74,200 @@ "covers": "random-mixed seed-862-long workload-01, query 3: DDSketch pane chain", "workload": "crates/devtools/tests/sketch_plan_snapshots/workloads/random-mixed-seed-862-long-w01-q3.json", "deployment": "mvp" + }, + { + "id": "quantile-over-time-phase-0-raw-retained", + "covers": "two quantiles over the same [5m] window at phase 0: sharing one state between quantiles", + "workload": "crates/devtools/tests/sketch_plan_snapshots/workloads/quantile-over-time-phase-0.json", + "deployment": "raw_retained" + }, + { + "id": "mixed-quantiles-raw-retained", + "covers": "five quantiles over [5m], [10m] and instant vectors, by job and by job, host, at 15 s, 60 s and 120 s: mixed windows, groupings and intervals", + "workload": "crates/devtools/tests/sketch_plan_snapshots/workloads/mixed-quantiles.json", + "deployment": "raw_retained" + }, + { + "id": "chains-10m-5m-3m-3m-raw-retained", + "covers": "quantiles over [10m] and [5m] every 5m and [3m] every 3m: chain widths across windows and intervals", + "workload": "crates/devtools/tests/sketch_plan_snapshots/workloads/chains-10m-5m-3m-3m.json", + "deployment": "raw_retained" + }, + { + "id": "chains-10m-5m-3m-10s-raw-retained", + "covers": "as chains-10m-5m-3m-3m with [3m] every 10 s: a fine chain next to coarse ones", + "workload": "crates/devtools/tests/sketch_plan_snapshots/workloads/chains-10m-5m-3m-10s.json", + "deployment": "raw_retained" + }, + { + "id": "chains-10m-5m-3m-10s-mvp", + "covers": "chains-10m-5m-3m-10s with raw data not retained: chains built at ingestion time", + "workload": "crates/devtools/tests/sketch_plan_snapshots/workloads/chains-10m-5m-3m-10s.json", + "deployment": "mvp" + }, + { + "id": "rollup-quantile-nested-labels-raw-retained", + "covers": "quantile by (job) and by (job, host): rollup of quantiles across nested labels", + "workload": "crates/devtools/tests/sketch_plan_snapshots/workloads/rollup-quantile-nested-labels.json", + "deployment": "raw_retained" + }, + { + "id": "rollup-quantile-disjoint-labels-raw-retained", + "covers": "quantile by (job) and by (host): rollup of quantiles across disjoint labels", + "workload": "crates/devtools/tests/sketch_plan_snapshots/workloads/rollup-quantile-disjoint-labels.json", + "deployment": "raw_retained" + }, + { + "id": "rollup-sum-chain-raw-retained", + "covers": "sum by (job, host), by (job) and sum: rollups for sums", + "workload": "crates/devtools/tests/sketch_plan_snapshots/workloads/rollup-sum-chain.json", + "deployment": "raw_retained" + }, + { + "id": "stddev-nested-labels-raw-retained", + "covers": "stddev by (job) and by (job, host): rollup for stddev", + "workload": "crates/devtools/tests/sketch_plan_snapshots/workloads/stddev-nested-labels.json", + "deployment": "raw_retained" + }, + { + "id": "avg-nested-labels-raw-retained", + "covers": "avg by (job, host), by (job) and avg: rollups for avg as Sum / Count", + "workload": "crates/devtools/tests/sketch_plan_snapshots/workloads/avg-nested-labels.json", + "deployment": "raw_retained" + }, + { + "id": "sql-rollup-quantile-same-window-raw-retained", + "covers": "SQL quantile GROUP BY job and job, host over the same 5 min: rollup of quantiles in SQL", + "workload": "crates/devtools/tests/sketch_plan_snapshots/workloads/sql-rollup-quantile-same-window.json", + "deployment": "raw_retained", + "tables": "crates/devtools/tests/sketch_plan_snapshots/workloads/sql-table-data.tables.json" + }, + { + "id": "sql-rollup-quantile-different-windows-raw-retained", + "covers": "SQL quantile GROUP BY job over 5 min and job, host over 10 min: rollup across windows (#1282)", + "workload": "crates/devtools/tests/sketch_plan_snapshots/workloads/sql-rollup-quantile-different-windows.json", + "deployment": "raw_retained", + "tables": "crates/devtools/tests/sketch_plan_snapshots/workloads/sql-table-data.tables.json" + }, + { + "id": "sum-avg-over-time-5m-raw-retained", + "covers": "sum_over_time and avg_over_time over [5m]: sharing Sum between sum and avg", + "workload": "crates/devtools/tests/sketch_plan_snapshots/workloads/sum-avg-over-time-5m.json", + "deployment": "raw_retained" + }, + { + "id": "sum-5m-avg-10m-over-time-raw-retained", + "covers": "sum_over_time [5m] and avg_over_time [10m]: sharing Sum across windows", + "workload": "crates/devtools/tests/sketch_plan_snapshots/workloads/sum-5m-avg-10m-over-time.json", + "deployment": "raw_retained" + }, + { + "id": "topk-5-and-10-raw-retained", + "covers": "topk(5) and topk(10) of a selector: top-k reuse", + "workload": "crates/devtools/tests/sketch_plan_snapshots/workloads/topk-5-and-10.json", + "deployment": "raw_retained" + }, + { + "id": "topk-by-job-and-global-raw-retained", + "covers": "topk by (job) and global topk: top-k reuse across groupings", + "workload": "crates/devtools/tests/sketch_plan_snapshots/workloads/topk-by-job-and-global.json", + "deployment": "raw_retained" + }, + { + "id": "topk-5-and-10-accuracy-raw-retained", + "covers": "topk-5-and-10 with an accuracy target: sketches for top-k of a selector", + "workload": "crates/devtools/tests/sketch_plan_snapshots/workloads/topk-5-and-10-accuracy.json", + "deployment": "raw_retained" + }, + { + "id": "topk-rate-counter-raw-retained", + "covers": "topk(5) and topk(10) of a counter rate: top-k reuse over a function", + "workload": "crates/devtools/tests/sketch_plan_snapshots/workloads/topk-rate-counter.json", + "deployment": "raw_retained" + }, + { + "id": "topk-sum-count-over-time-raw-retained", + "covers": "topk of sum_over_time and of count_over_time: top-k over shared Sum and Count", + "workload": "crates/devtools/tests/sketch_plan_snapshots/workloads/topk-sum-count-over-time.json", + "deployment": "raw_retained" + }, + { + "id": "topk-sum-count-over-time-accuracy-raw-retained", + "covers": "topk-sum-count-over-time with an accuracy target: heavy-hitter sketches for top-k", + "workload": "crates/devtools/tests/sketch_plan_snapshots/workloads/topk-sum-count-over-time-accuracy.json", + "deployment": "raw_retained" + }, + { + "id": "sum-over-time-two-intervals-raw-retained", + "covers": "sum_over_time [10m] every 5m and [5m] every 1m: exact chains across windows and intervals", + "workload": "crates/devtools/tests/sketch_plan_snapshots/workloads/sum-over-time-two-intervals.json", + "deployment": "raw_retained" + }, + { + "id": "distinct-over-time-1pct-raw-retained", + "covers": "distinct_over_time [10m] and [5m] at 1 %: distinct-count sketches at a tight target", + "workload": "crates/devtools/tests/sketch_plan_snapshots/workloads/distinct-over-time-1pct.json", + "deployment": "raw_retained" + }, + { + "id": "distinct-over-time-5pct-raw-retained", + "covers": "distinct_over_time [10m] and [5m] at 5 %: distinct-count sketches shared across windows", + "workload": "crates/devtools/tests/sketch_plan_snapshots/workloads/distinct-over-time-5pct.json", + "deployment": "raw_retained" + }, + { + "id": "entropy-over-time-raw-retained", + "covers": "entropy_over_time with an accuracy target: entropy sketches", + "workload": "crates/devtools/tests/sketch_plan_snapshots/workloads/entropy-over-time.json", + "deployment": "raw_retained" + }, + { + "id": "quantile-phase-0-and-30s-raw-retained", + "covers": "quantiles every 1m at phase 0 and 30 s: chains across evaluation phases", + "workload": "crates/devtools/tests/sketch_plan_snapshots/workloads/quantile-phase-0-and-30s.json", + "deployment": "raw_retained" + }, + { + "id": "quantile-7m-every-5m-raw-retained", + "covers": "quantile_over_time [7m] every 5m: a window that is not a multiple of the interval", + "workload": "crates/devtools/tests/sketch_plan_snapshots/workloads/quantile-7m-every-5m.json", + "deployment": "raw_retained" + }, + { + "id": "quantile-two-targets-raw-retained", + "covers": "one quantile at 1 % and 5 %: one query with two accuracy targets", + "workload": "crates/devtools/tests/sketch_plan_snapshots/workloads/quantile-two-targets.json", + "deployment": "raw_retained" + }, + { + "id": "distinct-two-forms-raw-retained", + "covers": "distinct_over_time and count(count_values): two forms of a distinct count", + "workload": "crates/devtools/tests/sketch_plan_snapshots/workloads/distinct-two-forms.json", + "deployment": "raw_retained" + }, + { + "id": "entropy-and-distinct-raw-retained", + "covers": "entropy_over_time and distinct_over_time: one sketch for both", + "workload": "crates/devtools/tests/sketch_plan_snapshots/workloads/entropy-and-distinct.json", + "deployment": "raw_retained" + }, + { + "id": "quantile-exact-raw-retained", + "covers": "quantile_over_time without an accuracy target", + "workload": "crates/devtools/tests/sketch_plan_snapshots/workloads/quantile-exact.json", + "deployment": "raw_retained" + }, + { + "id": "sign-unknown-raw-retained", + "covers": "quantile and topk of sum_over_time at 5 %, value sign unknown", + "workload": "crates/devtools/tests/sketch_plan_snapshots/workloads/sign-unknown.json", + "deployment": "raw_retained" + }, + { + "id": "sign-non-negative-raw-retained", + "covers": "as sign-unknown with the value declared non-negative: sketches that need a value sign", + "workload": "crates/devtools/tests/sketch_plan_snapshots/workloads/sign-non-negative.json", + "deployment": "raw_retained" } ] } diff --git a/crates/devtools/tests/sketch_plan_snapshots/mixed-quantiles-raw-retained.json b/crates/devtools/tests/sketch_plan_snapshots/mixed-quantiles-raw-retained.json new file mode 100644 index 000000000..dcd437aac --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/mixed-quantiles-raw-retained.json @@ -0,0 +1,1908 @@ +{ + "accuracy_guarantees": "enforced", + "materialized_views": [], + "queries": [ + "quantile_over_time(0.5, data[5m])", + "quantile_over_time(0.9, data[5m])", + "quantile by (job) (0.9, data)", + "quantile by (job, host) (0.5, data)", + "quantile_over_time(0.75, data[10m])" + ], + "selected": { + "accepted": [ + { + "accepted_metric": "rank", + "sketches": [ + "Kll" + ], + "summary": "accepted rank (Kll)" + }, + { + "accepted_metric": "rank", + "sketches": [ + "Kll" + ], + "summary": "accepted rank (Kll)" + }, + { + "accepted_metric": null, + "sketches": [], + "summary": "accepted exact" + }, + { + "accepted_metric": null, + "sketches": [], + "summary": "accepted exact" + }, + { + "accepted_metric": null, + "sketches": [], + "summary": "accepted exact" + } + ], + "cost": { + "cost_per_second": 5.92760058672e-8, + "cpu_core_seconds_per_second": 0.0052704, + "per_node": { + "0": { + "cost_per_second": 1.57416000515e-10, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.000014, + "detail": "scan 200000 samples; x 0.0167/s; holds 32 bytes for 0.840 ms; keeps 12800000 bytes of raw data on disk", + "multiplier": 1, + "operator": "Scan", + "timing": "query_time" + }, + "1": { + "cost_per_second": 4.1228000135e-10, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.0000366666666667, + "detail": "time range 300s: keep 200000 of 200000 rows; x 0.0167/s; holds 32 bytes for 2.200 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "10": { + "cost_per_second": 5.54704003632e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 4.93333333333e-6, + "detail": "scan 10000 samples; x 0.0667/s; holds 64 bytes for 0.074 ms", + "multiplier": 1, + "operator": "Scan", + "timing": "query_time" + }, + "11": { + "cost_per_second": 8.24560005398e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 7.33333333333e-6, + "detail": "time range 15s: keep 10000 of 10000 rows; x 0.0667/s; holds 64 bytes for 0.110 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "12": { + "cost_per_second": 2.04202736905e-8, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.001816, + "detail": "hash aggregate 10000 rows into 10000 groups: 54 ops per row, 10000 group visits; x 0.0667/s; holds 560000 bytes for 27.240 ms", + "multiplier": 1, + "operator": "Aggregate", + "timing": "query_time" + }, + "13": { + "cost_per_second": 1.57416000515e-10, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.000014, + "detail": "scan 400000 samples; x 0.0083/s; holds 32 bytes for 1.680 ms", + "multiplier": 1, + "operator": "Scan", + "timing": "query_time" + }, + "14": { + "cost_per_second": 4.1228000135e-10, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.0000366666666667, + "detail": "time range 600s: keep 400000 of 400000 rows; x 0.0083/s; holds 32 bytes for 4.400 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "15": { + "cost_per_second": 1.05919124745e-8, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.000941666666667, + "detail": "hash aggregate 400000 rows into 10000 groups: 49 ops per row, 400000 group visits; x 0.0083/s; holds 3520000 bytes for 113.000 ms", + "multiplier": 1, + "operator": "Aggregate", + "timing": "query_time" + }, + "2": { + "cost_per_second": 9.53035937107e-9, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.000846666666667, + "detail": "build Kll into 10000 states: 200000 rows x 84 ops, 200000 group visits; x 0.0167/s; holds 10720000 bytes for 50.800 ms", + "multiplier": 1, + "operator": "SummaryAgg", + "timing": "query_time" + }, + "3": { + "cost_per_second": 6.1842e-9, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.00055, + "detail": "estimate 10000 groups x 1; x 0.0167/s", + "multiplier": 1, + "operator": "SummaryEstimate", + "timing": "query_time" + }, + "4": { + "cost_per_second": 1.87400000613e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-7, + "detail": "operator: pass 10000 rows; x 0.0167/s; holds 32 bytes for 0.010 ms", + "multiplier": 1, + "operator": "Project", + "timing": "query_time" + }, + "5": { + "cost_per_second": 6.1842e-9, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.00055, + "detail": "estimate 10000 groups x 1; x 0.0167/s", + "multiplier": 1, + "operator": "SummaryEstimate", + "timing": "query_time" + }, + "6": { + "cost_per_second": 1.87400000613e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-7, + "detail": "operator: pass 10000 rows; x 0.0167/s; holds 32 bytes for 0.010 ms", + "multiplier": 1, + "operator": "Project", + "timing": "query_time" + }, + "7": { + "cost_per_second": 1.08692000534e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 9.66666666667e-7, + "detail": "scan 10000 samples; x 0.0167/s; holds 48 bytes for 0.058 ms", + "multiplier": 1, + "operator": "Scan", + "timing": "query_time" + }, + "8": { + "cost_per_second": 2.06140001012e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.83333333333e-6, + "detail": "time range 15s: keep 10000 of 10000 rows; x 0.0167/s; holds 48 bytes for 0.110 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "9": { + "cost_per_second": 5.05251072629e-9, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.000449333333333, + "detail": "hash aggregate 10000 rows into 10000 groups: 26 ops per row, 10000 group visits; x 0.0167/s; holds 400000 bytes for 26.960 ms", + "multiplier": 1, + "operator": "Aggregate", + "timing": "query_time" + } + }, + "source": "analytical-cost-v2 (illustrative statistics)", + "usage": { + "average_memory_bytes": 13587.6308395, + "cpu_ops_per_second": 5244000.0, + "disk_bytes": 12800000, + "peak_cpu_cores": 5, + "peak_memory_bytes": 15200416, + "scanned_bytes_per_second": 264000.0 + } + }, + "dag": { + "edges": [ + { + "consumer": 1, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 0, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 2, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 1, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 3, + "data_state": { + "primitive": "SummaryState", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Sketch": "Kll" + }, + "name": "state", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 2, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 4, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "quantile", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 3, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 5, + "data_state": { + "primitive": "SummaryState", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Sketch": "Kll" + }, + "name": "state", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 2, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 6, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "quantile", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 5, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 8, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 3, + 0 + ] + ] + }, + "producer": 7, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 9, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 3, + 0 + ] + ] + }, + "producer": 8, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 11, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "host", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 4, + 0 + ] + ] + }, + "producer": 10, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 12, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "host", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 4, + 0 + ] + ] + }, + "producer": 11, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 14, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 13, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 15, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 14, + "role": "Input", + "window": "NotApplicable" + } + ], + "nodes": [ + { + "id": 0, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Scan": { + "predicates": [], + "schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "source": { + "TimeSeries": { + "metric": "data" + } + } + } + } + }, + "retention_ms": 600000 + }, + { + "id": 1, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "TimeRange": { + "child": 0, + "kind": "range", + "range": { + "nanos": 0, + "secs": 300 + } + } + } + } + }, + { + "id": 2, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Sketch": "Kll" + }, + "name": "state", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "SummaryState", + "timing": "query_time" + }, + "parameters": { + "Kll": { + "k": 1404 + } + }, + "payload": { + "ASAP": { + "SummaryAgg": { + "child": 1, + "filter": null, + "input": { + "item": null, + "weight": { + "Column": "SampleValue" + } + }, + "reduction": "PerEntity", + "summary_type": { + "Sketch": "Kll" + } + } + } + } + }, + { + "id": 3, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "quantile", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "ASAP": { + "SummaryEstimate": { + "query": { + "Quantile": { + "q": 0.9 + } + }, + "summary_input": 2 + } + } + } + }, + { + "id": 4, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Project": { + "child": 3, + "cols": [ + { + "alias": "ts", + "expr": { + "Column": 0 + } + }, + { + "alias": "value", + "expr": { + "Column": 1 + } + }, + { + "alias": "$promql_series_identity", + "expr": { + "Column": 2 + } + } + ] + } + } + } + }, + { + "id": 5, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "quantile", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "ASAP": { + "SummaryEstimate": { + "query": { + "Quantile": { + "q": 0.5 + } + }, + "summary_input": 2 + } + } + } + }, + { + "id": 6, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Project": { + "child": 5, + "cols": [ + { + "alias": "ts", + "expr": { + "Column": 0 + } + }, + { + "alias": "value", + "expr": { + "Column": 1 + } + }, + { + "alias": "$promql_series_identity", + "expr": { + "Column": 2 + } + } + ] + } + } + } + }, + { + "id": 7, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 3, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Scan": { + "predicates": [], + "schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 3, + 0 + ] + ] + }, + "source": { + "TimeSeries": { + "metric": "data" + } + } + } + } + }, + "retention_ms": 15000 + }, + { + "id": 8, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 3, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "TimeRange": { + "child": 7, + "kind": "instant", + "range": { + "nanos": 0, + "secs": 15 + } + } + } + } + }, + { + "id": 9, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "quantile_0_9", + "nullable": false + } + ], + "time_index": null, + "unique_keys": [ + [ + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Aggregate": { + "child": 8, + "filters": [], + "having": null, + "measures": [ + { + "col": null, + "kind": "quantile", + "q": 0.9 + } + ], + "output_names": [ + "" + ], + "reduction": { + "Reduce": [ + 2 + ] + } + } + } + } + }, + { + "id": 10, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "host", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 4, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Scan": { + "predicates": [], + "schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "host", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 4, + 0 + ] + ] + }, + "source": { + "TimeSeries": { + "metric": "data" + } + } + } + } + }, + "retention_ms": 15000 + }, + { + "id": 11, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "host", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 4, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "TimeRange": { + "child": 10, + "kind": "instant", + "range": { + "nanos": 0, + "secs": 15 + } + } + } + } + }, + { + "id": 12, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "utf8" + }, + "name": "host", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "quantile_0_5", + "nullable": false + } + ], + "time_index": null, + "unique_keys": [ + [ + 0, + 1 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Aggregate": { + "child": 11, + "filters": [], + "having": null, + "measures": [ + { + "col": null, + "kind": "quantile", + "q": 0.5 + } + ], + "output_names": [ + "" + ], + "reduction": { + "Reduce": [ + 2, + 3 + ] + } + } + } + } + }, + { + "id": 13, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Scan": { + "predicates": [], + "schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "source": { + "TimeSeries": { + "metric": "data" + } + } + } + } + }, + "retention_ms": 600000 + }, + { + "id": 14, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "TimeRange": { + "child": 13, + "kind": "range", + "range": { + "nanos": 0, + "secs": 600 + } + } + } + } + }, + { + "id": 15, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Aggregate": { + "child": 14, + "filters": [], + "having": null, + "measures": [ + { + "col": null, + "kind": "quantile", + "q": 0.75 + } + ], + "output_names": [ + "" + ], + "reduction": "PerEntity" + } + } + } + } + ], + "roots": [ + 6, + 4, + 9, + 12, + 15 + ], + "scalar_roots": [] + } + } +} diff --git a/crates/devtools/tests/sketch_plan_snapshots/quantile-7m-every-5m-raw-retained.json b/crates/devtools/tests/sketch_plan_snapshots/quantile-7m-every-5m-raw-retained.json new file mode 100644 index 000000000..eaede18d2 --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/quantile-7m-every-5m-raw-retained.json @@ -0,0 +1,359 @@ +{ + "accuracy_guarantees": "enforced", + "materialized_views": [], + "queries": [ + "quantile_over_time(0.9, data[7m])" + ], + "selected": { + "accepted": [ + { + "accepted_metric": null, + "sketches": [], + "summary": "accepted exact" + } + ], + "cost": { + "cost_per_second": 3.37464140619e-9, + "cpu_core_seconds_per_second": 0.000300053333333, + "per_node": { + "0": { + "cost_per_second": 4.40764801443e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 3.92e-6, + "detail": "scan 280000 samples; x 0.0033/s; holds 32 bytes for 1.176 ms; keeps 8960000 bytes of raw data on disk", + "multiplier": 1, + "operator": "Scan", + "timing": "query_time" + }, + "1": { + "cost_per_second": 1.15438400378e-10, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.0000102666666667, + "detail": "time range 420s: keep 280000 of 280000 rows; x 0.0033/s; holds 32 bytes for 3.080 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "2": { + "cost_per_second": 3.21512652567e-9, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.000285866666667, + "detail": "hash aggregate 280000 rows into 10000 groups: 46 ops per row, 280000 group visits; x 0.0033/s; holds 2560000 bytes for 85.760 ms", + "multiplier": 1, + "operator": "Aggregate", + "timing": "query_time" + } + }, + "source": "analytical-cost-v2 (illustrative statistics)", + "usage": { + "average_memory_bytes": 731.81912064, + "cpu_ops_per_second": 297066.666667, + "disk_bytes": 8960000, + "peak_cpu_cores": 1, + "peak_memory_bytes": 2560064, + "scanned_bytes_per_second": 29866.6666667 + } + }, + "dag": { + "edges": [ + { + "consumer": 1, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 0, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 2, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 1, + "role": "Input", + "window": "NotApplicable" + } + ], + "nodes": [ + { + "id": 0, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Scan": { + "predicates": [], + "schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "source": { + "TimeSeries": { + "metric": "data" + } + } + } + } + }, + "retention_ms": 420000 + }, + { + "id": 1, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "TimeRange": { + "child": 0, + "kind": "range", + "range": { + "nanos": 0, + "secs": 420 + } + } + } + } + }, + { + "id": 2, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Aggregate": { + "child": 1, + "filters": [], + "having": null, + "measures": [ + { + "col": null, + "kind": "quantile", + "q": 0.9 + } + ], + "output_names": [ + "" + ], + "reduction": "PerEntity" + } + } + } + } + ], + "roots": [ + 2 + ], + "scalar_roots": [] + } + } +} diff --git a/crates/devtools/tests/sketch_plan_snapshots/quantile-exact-raw-retained.json b/crates/devtools/tests/sketch_plan_snapshots/quantile-exact-raw-retained.json new file mode 100644 index 000000000..f13829973 --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/quantile-exact-raw-retained.json @@ -0,0 +1,359 @@ +{ + "accuracy_guarantees": "enforced", + "materialized_views": [], + "queries": [ + "quantile_over_time(0.9, data[5m])" + ], + "selected": { + "accepted": [ + { + "accepted_metric": null, + "sketches": [], + "summary": "accepted exact" + } + ], + "cost": { + "cost_per_second": 1.32779114397e-8, + "cpu_core_seconds_per_second": 0.00118066666667, + "per_node": { + "0": { + "cost_per_second": 1.57416000515e-10, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.000014, + "detail": "scan 200000 samples; x 0.0167/s; holds 32 bytes for 0.840 ms; keeps 6400000 bytes of raw data on disk", + "multiplier": 1, + "operator": "Scan", + "timing": "query_time" + }, + "1": { + "cost_per_second": 4.1228000135e-10, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.0000366666666667, + "detail": "time range 300s: keep 200000 of 200000 rows; x 0.0167/s; holds 32 bytes for 2.200 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "2": { + "cost_per_second": 1.27082154379e-8, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.00113, + "detail": "hash aggregate 200000 rows into 10000 groups: 44 ops per row, 200000 group visits; x 0.0167/s; holds 1920000 bytes for 67.800 ms", + "multiplier": 1, + "operator": "Aggregate", + "timing": "query_time" + } + }, + "source": "analytical-cost-v2 (illustrative statistics)", + "usage": { + "average_memory_bytes": 2169.60162133, + "cpu_ops_per_second": 1170000.0, + "disk_bytes": 6400000, + "peak_cpu_cores": 1, + "peak_memory_bytes": 1920064, + "scanned_bytes_per_second": 106666.666667 + } + }, + "dag": { + "edges": [ + { + "consumer": 1, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 0, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 2, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 1, + "role": "Input", + "window": "NotApplicable" + } + ], + "nodes": [ + { + "id": 0, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Scan": { + "predicates": [], + "schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "source": { + "TimeSeries": { + "metric": "data" + } + } + } + } + }, + "retention_ms": 300000 + }, + { + "id": 1, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "TimeRange": { + "child": 0, + "kind": "range", + "range": { + "nanos": 0, + "secs": 300 + } + } + } + } + }, + { + "id": 2, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Aggregate": { + "child": 1, + "filters": [], + "having": null, + "measures": [ + { + "col": null, + "kind": "quantile", + "q": 0.9 + } + ], + "output_names": [ + "" + ], + "reduction": "PerEntity" + } + } + } + } + ], + "roots": [ + 2 + ], + "scalar_roots": [] + } + } +} diff --git a/crates/devtools/tests/sketch_plan_snapshots/quantile-over-time-phase-0-raw-retained.json b/crates/devtools/tests/sketch_plan_snapshots/quantile-over-time-phase-0-raw-retained.json new file mode 100644 index 000000000..a8d05dcdc --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/quantile-over-time-phase-0-raw-retained.json @@ -0,0 +1,827 @@ +{ + "accuracy_guarantees": "enforced", + "materialized_views": [], + "queries": [ + "quantile_over_time(0.5, data[5m])", + "quantile_over_time(0.9, data[5m])" + ], + "selected": { + "accepted": [ + { + "accepted_metric": "rank", + "sketches": [ + "Kll" + ], + "summary": "accepted rank (Kll)" + }, + { + "accepted_metric": "rank", + "sketches": [ + "Kll" + ], + "summary": "accepted rank (Kll)" + } + ], + "cost": { + "cost_per_second": 2.24722033729e-8, + "cpu_core_seconds_per_second": 0.00199766666667, + "per_node": { + "0": { + "cost_per_second": 1.57416000515e-10, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.000014, + "detail": "scan 200000 samples; x 0.0167/s; holds 32 bytes for 0.840 ms; keeps 6400000 bytes of raw data on disk", + "multiplier": 1, + "operator": "Scan", + "timing": "query_time" + }, + "1": { + "cost_per_second": 4.1228000135e-10, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.0000366666666667, + "detail": "time range 300s: keep 200000 of 200000 rows; x 0.0167/s; holds 32 bytes for 2.200 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "2": { + "cost_per_second": 9.53035937107e-9, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.000846666666667, + "detail": "build Kll into 10000 states: 200000 rows x 84 ops, 200000 group visits; x 0.0167/s; holds 10720000 bytes for 50.800 ms", + "multiplier": 1, + "operator": "SummaryAgg", + "timing": "query_time" + }, + "3": { + "cost_per_second": 6.1842e-9, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.00055, + "detail": "estimate 10000 groups x 1; x 0.0167/s", + "multiplier": 1, + "operator": "SummaryEstimate", + "timing": "query_time" + }, + "4": { + "cost_per_second": 1.87400000613e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-7, + "detail": "operator: pass 10000 rows; x 0.0167/s; holds 32 bytes for 0.010 ms", + "multiplier": 1, + "operator": "Project", + "timing": "query_time" + }, + "5": { + "cost_per_second": 6.1842e-9, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.00055, + "detail": "estimate 10000 groups x 1; x 0.0167/s", + "multiplier": 1, + "operator": "SummaryEstimate", + "timing": "query_time" + }, + "6": { + "cost_per_second": 1.87400000613e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-7, + "detail": "operator: pass 10000 rows; x 0.0167/s; holds 32 bytes for 0.010 ms", + "multiplier": 1, + "operator": "Project", + "timing": "query_time" + } + }, + "source": "analytical-cost-v2 (illustrative statistics)", + "usage": { + "average_memory_bytes": 9076.26829867, + "cpu_ops_per_second": 1987000.0, + "disk_bytes": 6400000, + "peak_cpu_cores": 2, + "peak_memory_bytes": 10720128, + "scanned_bytes_per_second": 106666.666667 + } + }, + "dag": { + "edges": [ + { + "consumer": 1, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 0, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 2, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 1, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 3, + "data_state": { + "primitive": "SummaryState", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Sketch": "Kll" + }, + "name": "state", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 2, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 4, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "quantile", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 3, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 5, + "data_state": { + "primitive": "SummaryState", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Sketch": "Kll" + }, + "name": "state", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 2, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 6, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "quantile", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 5, + "role": "Input", + "window": "NotApplicable" + } + ], + "nodes": [ + { + "id": 0, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Scan": { + "predicates": [], + "schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "source": { + "TimeSeries": { + "metric": "data" + } + } + } + } + }, + "retention_ms": 300000 + }, + { + "id": 1, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "TimeRange": { + "child": 0, + "kind": "range", + "range": { + "nanos": 0, + "secs": 300 + } + } + } + } + }, + { + "id": 2, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Sketch": "Kll" + }, + "name": "state", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "SummaryState", + "timing": "query_time" + }, + "parameters": { + "Kll": { + "k": 2863 + } + }, + "payload": { + "ASAP": { + "SummaryAgg": { + "child": 1, + "filter": null, + "input": { + "item": null, + "weight": { + "Column": "SampleValue" + } + }, + "reduction": "PerEntity", + "summary_type": { + "Sketch": "Kll" + } + } + } + } + }, + { + "id": 3, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "quantile", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "ASAP": { + "SummaryEstimate": { + "query": { + "Quantile": { + "q": 0.9 + } + }, + "summary_input": 2 + } + } + } + }, + { + "id": 4, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Project": { + "child": 3, + "cols": [ + { + "alias": "ts", + "expr": { + "Column": 0 + } + }, + { + "alias": "value", + "expr": { + "Column": 1 + } + }, + { + "alias": "$promql_series_identity", + "expr": { + "Column": 2 + } + } + ] + } + } + } + }, + { + "id": 5, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "quantile", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "ASAP": { + "SummaryEstimate": { + "query": { + "Quantile": { + "q": 0.5 + } + }, + "summary_input": 2 + } + } + } + }, + { + "id": 6, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Project": { + "child": 5, + "cols": [ + { + "alias": "ts", + "expr": { + "Column": 0 + } + }, + { + "alias": "value", + "expr": { + "Column": 1 + } + }, + { + "alias": "$promql_series_identity", + "expr": { + "Column": 2 + } + } + ] + } + } + } + } + ], + "roots": [ + 6, + 4 + ], + "scalar_roots": [] + } + } +} diff --git a/crates/devtools/tests/sketch_plan_snapshots/quantile-phase-0-and-30s-raw-retained.json b/crates/devtools/tests/sketch_plan_snapshots/quantile-phase-0-and-30s-raw-retained.json new file mode 100644 index 000000000..98bb01e21 --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/quantile-phase-0-and-30s-raw-retained.json @@ -0,0 +1,684 @@ +{ + "accuracy_guarantees": "enforced", + "materialized_views": [], + "queries": [ + "quantile_over_time(0.9, data[5m])", + "quantile_over_time(0.5, data[5m])" + ], + "selected": { + "accepted": [ + { + "accepted_metric": null, + "sketches": [], + "summary": "accepted exact" + }, + { + "accepted_metric": null, + "sketches": [], + "summary": "accepted exact" + } + ], + "cost": { + "cost_per_second": 2.65558228795e-8, + "cpu_core_seconds_per_second": 0.00236133333333, + "per_node": { + "0": { + "cost_per_second": 1.57416000515e-10, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.000014, + "detail": "scan 200000 samples; x 0.0167/s; holds 32 bytes for 0.840 ms; keeps 6400000 bytes of raw data on disk", + "multiplier": 1, + "operator": "Scan", + "timing": "query_time" + }, + "1": { + "cost_per_second": 4.1228000135e-10, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.0000366666666667, + "detail": "time range 300s: keep 200000 of 200000 rows; x 0.0167/s; holds 32 bytes for 2.200 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "2": { + "cost_per_second": 1.27082154379e-8, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.00113, + "detail": "hash aggregate 200000 rows into 10000 groups: 44 ops per row, 200000 group visits; x 0.0167/s; holds 1920000 bytes for 67.800 ms", + "multiplier": 1, + "operator": "Aggregate", + "timing": "query_time" + }, + "3": { + "cost_per_second": 1.57416000515e-10, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.000014, + "detail": "scan 200000 samples; x 0.0167/s; holds 32 bytes for 0.840 ms", + "multiplier": 1, + "operator": "Scan", + "timing": "query_time" + }, + "4": { + "cost_per_second": 4.1228000135e-10, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.0000366666666667, + "detail": "time range 300s: keep 200000 of 200000 rows; x 0.0167/s; holds 32 bytes for 2.200 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "5": { + "cost_per_second": 1.27082154379e-8, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.00113, + "detail": "hash aggregate 200000 rows into 10000 groups: 44 ops per row, 200000 group visits; x 0.0167/s; holds 1920000 bytes for 67.800 ms", + "multiplier": 1, + "operator": "Aggregate", + "timing": "query_time" + } + }, + "source": "analytical-cost-v2 (illustrative statistics)", + "usage": { + "average_memory_bytes": 4339.20324267, + "cpu_ops_per_second": 2340000.0, + "disk_bytes": 6400000, + "peak_cpu_cores": 2, + "peak_memory_bytes": 3840128, + "scanned_bytes_per_second": 213333.333333 + } + }, + "dag": { + "edges": [ + { + "consumer": 1, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 0, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 2, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 1, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 4, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 3, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 5, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 4, + "role": "Input", + "window": "NotApplicable" + } + ], + "nodes": [ + { + "id": 0, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Scan": { + "predicates": [], + "schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "source": { + "TimeSeries": { + "metric": "data" + } + } + } + } + }, + "retention_ms": 300000 + }, + { + "id": 1, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "TimeRange": { + "child": 0, + "kind": "range", + "range": { + "nanos": 0, + "secs": 300 + } + } + } + } + }, + { + "id": 2, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Aggregate": { + "child": 1, + "filters": [], + "having": null, + "measures": [ + { + "col": null, + "kind": "quantile", + "q": 0.9 + } + ], + "output_names": [ + "" + ], + "reduction": "PerEntity" + } + } + } + }, + { + "id": 3, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Scan": { + "predicates": [], + "schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "source": { + "TimeSeries": { + "metric": "data" + } + } + } + } + }, + "retention_ms": 300000 + }, + { + "id": 4, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "TimeRange": { + "child": 3, + "kind": "range", + "range": { + "nanos": 0, + "secs": 300 + } + } + } + } + }, + { + "id": 5, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Aggregate": { + "child": 4, + "filters": [], + "having": null, + "measures": [ + { + "col": null, + "kind": "quantile", + "q": 0.5 + } + ], + "output_names": [ + "" + ], + "reduction": "PerEntity" + } + } + } + } + ], + "roots": [ + 2, + 5 + ], + "scalar_roots": [] + } + } +} diff --git a/crates/devtools/tests/sketch_plan_snapshots/quantile-two-targets-raw-retained.json b/crates/devtools/tests/sketch_plan_snapshots/quantile-two-targets-raw-retained.json new file mode 100644 index 000000000..522c41abc --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/quantile-two-targets-raw-retained.json @@ -0,0 +1,366 @@ +{ + "accuracy_guarantees": "enforced", + "materialized_views": [], + "queries": [ + "quantile_over_time(0.9, data[5m])", + "quantile_over_time(0.9, data[5m])" + ], + "selected": { + "accepted": [ + { + "accepted_metric": null, + "sketches": [], + "summary": "accepted exact" + }, + { + "accepted_metric": null, + "sketches": [], + "summary": "accepted exact" + } + ], + "cost": { + "cost_per_second": 1.32779114397e-8, + "cpu_core_seconds_per_second": 0.00118066666667, + "per_node": { + "0": { + "cost_per_second": 1.57416000515e-10, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.000014, + "detail": "scan 200000 samples; x 0.0167/s; holds 32 bytes for 0.840 ms; keeps 6400000 bytes of raw data on disk", + "multiplier": 1, + "operator": "Scan", + "timing": "query_time" + }, + "1": { + "cost_per_second": 4.1228000135e-10, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.0000366666666667, + "detail": "time range 300s: keep 200000 of 200000 rows; x 0.0167/s; holds 32 bytes for 2.200 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "2": { + "cost_per_second": 1.27082154379e-8, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.00113, + "detail": "hash aggregate 200000 rows into 10000 groups: 44 ops per row, 200000 group visits; x 0.0167/s; holds 1920000 bytes for 67.800 ms", + "multiplier": 1, + "operator": "Aggregate", + "timing": "query_time" + } + }, + "source": "analytical-cost-v2 (illustrative statistics)", + "usage": { + "average_memory_bytes": 2169.60162133, + "cpu_ops_per_second": 1170000.0, + "disk_bytes": 6400000, + "peak_cpu_cores": 2, + "peak_memory_bytes": 1920064, + "scanned_bytes_per_second": 106666.666667 + } + }, + "dag": { + "edges": [ + { + "consumer": 1, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 0, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 2, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 1, + "role": "Input", + "window": "NotApplicable" + } + ], + "nodes": [ + { + "id": 0, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Scan": { + "predicates": [], + "schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "source": { + "TimeSeries": { + "metric": "data" + } + } + } + } + }, + "retention_ms": 300000 + }, + { + "id": 1, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "TimeRange": { + "child": 0, + "kind": "range", + "range": { + "nanos": 0, + "secs": 300 + } + } + } + } + }, + { + "id": 2, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Aggregate": { + "child": 1, + "filters": [], + "having": null, + "measures": [ + { + "col": null, + "kind": "quantile", + "q": 0.9 + } + ], + "output_names": [ + "" + ], + "reduction": "PerEntity" + } + } + } + } + ], + "roots": [ + 2, + 2 + ], + "scalar_roots": [] + } + } +} diff --git a/crates/devtools/tests/sketch_plan_snapshots/rollup-quantile-disjoint-labels-raw-retained.json b/crates/devtools/tests/sketch_plan_snapshots/rollup-quantile-disjoint-labels-raw-retained.json new file mode 100644 index 000000000..fb5fa28a0 --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/rollup-quantile-disjoint-labels-raw-retained.json @@ -0,0 +1,746 @@ +{ + "accuracy_guarantees": "enforced", + "materialized_views": [], + "queries": [ + "quantile by (job) (0.9, data)", + "quantile by (host) (0.9, data)" + ], + "selected": { + "accepted": [ + { + "accepted_metric": null, + "sketches": [], + "summary": "accepted exact" + }, + { + "accepted_metric": null, + "sketches": [], + "summary": "accepted exact" + } + ], + "cost": { + "cost_per_second": 7.98060219856e-10, + "cpu_core_seconds_per_second": 0.0000709758333333, + "per_node": { + "0": { + "cost_per_second": 1.08692000534e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 9.66666666667e-7, + "detail": "scan 10000 samples; x 0.0167/s; holds 48 bytes for 0.058 ms; keeps 480000 bytes of raw data on disk", + "multiplier": 1, + "operator": "Scan", + "timing": "query_time" + }, + "1": { + "cost_per_second": 2.06140001012e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.83333333333e-6, + "detail": "time range 15s: keep 10000 of 10000 rows; x 0.0167/s; holds 48 bytes for 0.110 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "2": { + "cost_per_second": 1.45714067203e-10, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.0000129591666667, + "detail": "hash aggregate 10000 rows into 10 groups: 75 ops per row, 15 group visits; x 0.0167/s; holds 80320 bytes for 0.778 ms", + "multiplier": 1, + "operator": "Aggregate", + "timing": "query_time" + }, + "3": { + "cost_per_second": 1.08692000534e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 9.66666666667e-7, + "detail": "scan 10000 samples; x 0.0167/s; holds 48 bytes for 0.058 ms", + "multiplier": 1, + "operator": "Scan", + "timing": "query_time" + }, + "4": { + "cost_per_second": 2.06140001012e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.83333333333e-6, + "detail": "time range 15s: keep 10000 of 10000 rows; x 0.0167/s; holds 48 bytes for 0.110 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "5": { + "cost_per_second": 5.89379752343e-10, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.0000524166666667, + "detail": "hash aggregate 10000 rows into 1000 groups: 38 ops per row, 1500 group visits; x 0.0167/s; holds 112000 bytes for 3.145 ms", + "multiplier": 1, + "operator": "Aggregate", + "timing": "query_time" + } + }, + "source": "analytical-cost-v2 (illustrative statistics)", + "usage": { + "average_memory_bytes": 6.91181573333, + "cpu_ops_per_second": 69375.8333333, + "disk_bytes": 480000, + "peak_cpu_cores": 2, + "peak_memory_bytes": 192512, + "scanned_bytes_per_second": 16000.0 + } + }, + "dag": { + "edges": [ + { + "consumer": 1, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 3, + 0 + ] + ] + }, + "producer": 0, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 2, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 3, + 0 + ] + ] + }, + "producer": 1, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 4, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "host", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 3, + 0 + ] + ] + }, + "producer": 3, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 5, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "host", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 3, + 0 + ] + ] + }, + "producer": 4, + "role": "Input", + "window": "NotApplicable" + } + ], + "nodes": [ + { + "id": 0, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 3, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Scan": { + "predicates": [], + "schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 3, + 0 + ] + ] + }, + "source": { + "TimeSeries": { + "metric": "data" + } + } + } + } + }, + "retention_ms": 15000 + }, + { + "id": 1, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 3, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "TimeRange": { + "child": 0, + "kind": "instant", + "range": { + "nanos": 0, + "secs": 15 + } + } + } + } + }, + { + "id": 2, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "quantile_0_9", + "nullable": false + } + ], + "time_index": null, + "unique_keys": [ + [ + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Aggregate": { + "child": 1, + "filters": [], + "having": null, + "measures": [ + { + "col": null, + "kind": "quantile", + "q": 0.9 + } + ], + "output_names": [ + "" + ], + "reduction": { + "Reduce": [ + 2 + ] + } + } + } + } + }, + { + "id": 3, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "host", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 3, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Scan": { + "predicates": [], + "schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "host", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 3, + 0 + ] + ] + }, + "source": { + "TimeSeries": { + "metric": "data" + } + } + } + } + }, + "retention_ms": 15000 + }, + { + "id": 4, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "host", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 3, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "TimeRange": { + "child": 3, + "kind": "instant", + "range": { + "nanos": 0, + "secs": 15 + } + } + } + } + }, + { + "id": 5, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "utf8" + }, + "name": "host", + "nullable": true + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "quantile_0_9", + "nullable": false + } + ], + "time_index": null, + "unique_keys": [ + [ + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Aggregate": { + "child": 4, + "filters": [], + "having": null, + "measures": [ + { + "col": null, + "kind": "quantile", + "q": 0.9 + } + ], + "output_names": [ + "" + ], + "reduction": { + "Reduce": [ + 2 + ] + } + } + } + } + } + ], + "roots": [ + 2, + 5 + ], + "scalar_roots": [] + } + } +} diff --git a/crates/devtools/tests/sketch_plan_snapshots/rollup-quantile-nested-labels-raw-retained.json b/crates/devtools/tests/sketch_plan_snapshots/rollup-quantile-nested-labels-raw-retained.json new file mode 100644 index 000000000..cd95add8a --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/rollup-quantile-nested-labels-raw-retained.json @@ -0,0 +1,790 @@ +{ + "accuracy_guarantees": "enforced", + "materialized_views": [], + "queries": [ + "quantile by (job) (0.9, data)", + "quantile by (job, host) (0.9, data)" + ], + "selected": { + "accepted": [ + { + "accepted_metric": null, + "sketches": [], + "summary": "accepted exact" + }, + { + "accepted_metric": null, + "sketches": [], + "summary": "accepted exact" + } + ], + "cost": { + "cost_per_second": 5.31674729021e-9, + "cpu_core_seconds_per_second": 0.000472825833333, + "per_node": { + "0": { + "cost_per_second": 1.08692000534e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 9.66666666667e-7, + "detail": "scan 10000 samples; x 0.0167/s; holds 48 bytes for 0.058 ms", + "multiplier": 1, + "operator": "Scan", + "timing": "query_time" + }, + "1": { + "cost_per_second": 2.06140001012e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.83333333333e-6, + "detail": "time range 15s: keep 10000 of 10000 rows; x 0.0167/s; holds 48 bytes for 0.110 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "2": { + "cost_per_second": 1.45714067203e-10, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.0000129591666667, + "detail": "hash aggregate 10000 rows into 10 groups: 75 ops per row, 15 group visits; x 0.0167/s; holds 80320 bytes for 0.778 ms", + "multiplier": 1, + "operator": "Aggregate", + "timing": "query_time" + }, + "3": { + "cost_per_second": 1.38676000908e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.23333333333e-6, + "detail": "scan 10000 samples; x 0.0167/s; holds 64 bytes for 0.074 ms; keeps 640000 bytes of raw data on disk", + "multiplier": 1, + "operator": "Scan", + "timing": "query_time" + }, + "4": { + "cost_per_second": 2.0614000135e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.83333333333e-6, + "detail": "time range 15s: keep 10000 of 10000 rows; x 0.0167/s; holds 64 bytes for 0.110 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "5": { + "cost_per_second": 5.10506842262e-9, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.000454, + "detail": "hash aggregate 10000 rows into 10000 groups: 54 ops per row, 10000 group visits; x 0.0167/s; holds 560000 bytes for 27.240 ms", + "multiplier": 1, + "operator": "Aggregate", + "timing": "query_time" + } + }, + "source": "analytical-cost-v2 (illustrative statistics)", + "usage": { + "average_memory_bytes": 255.281210933, + "cpu_ops_per_second": 470959.166667, + "disk_bytes": 640000, + "peak_cpu_cores": 2, + "peak_memory_bytes": 640544, + "scanned_bytes_per_second": 18666.6666667 + } + }, + "dag": { + "edges": [ + { + "consumer": 1, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 3, + 0 + ] + ] + }, + "producer": 0, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 2, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 3, + 0 + ] + ] + }, + "producer": 1, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 4, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "host", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 4, + 0 + ] + ] + }, + "producer": 3, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 5, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "host", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 4, + 0 + ] + ] + }, + "producer": 4, + "role": "Input", + "window": "NotApplicable" + } + ], + "nodes": [ + { + "id": 0, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 3, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Scan": { + "predicates": [], + "schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 3, + 0 + ] + ] + }, + "source": { + "TimeSeries": { + "metric": "data" + } + } + } + } + }, + "retention_ms": 15000 + }, + { + "id": 1, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 3, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "TimeRange": { + "child": 0, + "kind": "instant", + "range": { + "nanos": 0, + "secs": 15 + } + } + } + } + }, + { + "id": 2, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "quantile_0_9", + "nullable": false + } + ], + "time_index": null, + "unique_keys": [ + [ + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Aggregate": { + "child": 1, + "filters": [], + "having": null, + "measures": [ + { + "col": null, + "kind": "quantile", + "q": 0.9 + } + ], + "output_names": [ + "" + ], + "reduction": { + "Reduce": [ + 2 + ] + } + } + } + } + }, + { + "id": 3, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "host", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 4, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Scan": { + "predicates": [], + "schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "host", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 4, + 0 + ] + ] + }, + "source": { + "TimeSeries": { + "metric": "data" + } + } + } + } + }, + "retention_ms": 15000 + }, + { + "id": 4, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "host", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 4, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "TimeRange": { + "child": 3, + "kind": "instant", + "range": { + "nanos": 0, + "secs": 15 + } + } + } + } + }, + { + "id": 5, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "utf8" + }, + "name": "host", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "quantile_0_9", + "nullable": false + } + ], + "time_index": null, + "unique_keys": [ + [ + 0, + 1 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Aggregate": { + "child": 4, + "filters": [], + "having": null, + "measures": [ + { + "col": null, + "kind": "quantile", + "q": 0.9 + } + ], + "output_names": [ + "" + ], + "reduction": { + "Reduce": [ + 2, + 3 + ] + } + } + } + } + } + ], + "roots": [ + 2, + 5 + ], + "scalar_roots": [] + } + } +} diff --git a/crates/devtools/tests/sketch_plan_snapshots/rollup-sum-chain-raw-retained.json b/crates/devtools/tests/sketch_plan_snapshots/rollup-sum-chain-raw-retained.json new file mode 100644 index 000000000..67598266b --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/rollup-sum-chain-raw-retained.json @@ -0,0 +1,759 @@ +{ + "accuracy_guarantees": "enforced", + "materialized_views": [], + "queries": [ + "sum by (job) (data)", + "sum by (job, host) (data)", + "sum (data)" + ], + "selected": { + "accepted": [ + { + "accepted_metric": null, + "sketches": [], + "summary": "accepted exact" + }, + { + "accepted_metric": null, + "sketches": [], + "summary": "accepted exact" + }, + { + "accepted_metric": null, + "sketches": [], + "summary": "accepted exact" + } + ], + "cost": { + "cost_per_second": 5.13562430321e-9, + "cpu_core_seconds_per_second": 0.0004567235, + "per_node": { + "0": { + "cost_per_second": 1.38676000908e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.23333333333e-6, + "detail": "scan 10000 samples; x 0.0167/s; holds 64 bytes for 0.074 ms; keeps 640000 bytes of raw data on disk", + "multiplier": 1, + "operator": "Scan", + "timing": "query_time" + }, + "1": { + "cost_per_second": 2.0614000135e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.83333333333e-6, + "detail": "time range 15s: keep 10000 of 10000 rows; x 0.0167/s; holds 64 bytes for 0.110 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "2": { + "cost_per_second": 3.72959570019e-10, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.0000331666666667, + "detail": "build exact Sum accumulator into 10000 states: 10000 rows x 29 ops, 10000 group visits; x 0.0167/s; holds 880000 bytes for 1.990 ms", + "multiplier": 1, + "operator": "SummaryAgg", + "timing": "query_time" + }, + "3": { + "cost_per_second": 4.68519169723e-9, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.000416666666667, + "detail": "finalize 10000 accumulators; x 0.0167/s; holds 400000 bytes for 25.000 ms", + "multiplier": 1, + "operator": "FinalizeExactAccumulator", + "timing": "query_time" + }, + "4": { + "cost_per_second": 4.24835817383e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 3.77833333333e-6, + "detail": "hash aggregate 10000 rows into 10 groups: 20 ops per row, 10 group visits; x 0.0167/s; holds 400 bytes for 0.227 ms", + "multiplier": 1, + "operator": "Aggregate", + "timing": "query_time" + }, + "5": { + "cost_per_second": 5.07854001247e-13, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 4.51666666667e-8, + "detail": "hash aggregate 10 rows into 1 groups: 4 ops per row, 1 group visits; x 0.0167/s; holds 24 bytes for 0.003 ms", + "multiplier": 1, + "operator": "Aggregate", + "timing": "query_time" + } + }, + "source": "analytical-cost-v2 (illustrative statistics)", + "usage": { + "average_memory_bytes": 195.855042017, + "cpu_ops_per_second": 455656.833333, + "disk_bytes": 640000, + "peak_cpu_cores": 3, + "peak_memory_bytes": 1280552, + "scanned_bytes_per_second": 10666.6666667 + } + }, + "dag": { + "edges": [ + { + "consumer": 1, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "host", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 4, + 0 + ] + ] + }, + "producer": 0, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 2, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "host", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 4, + 0 + ] + ] + }, + "producer": 1, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 3, + "data_state": { + "primitive": "SummaryState", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "utf8" + }, + "name": "host", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "ExactAggregate": [ + "Sum", + "Sum" + ] + }, + "name": "state", + "nullable": false + } + ], + "time_index": null, + "unique_keys": [ + [ + 0, + 1 + ] + ] + }, + "producer": 2, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 4, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "utf8" + }, + "name": "host", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "sum", + "nullable": false + } + ], + "time_index": null, + "unique_keys": [ + [ + 0, + 1 + ] + ] + }, + "producer": 3, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 5, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "sum", + "nullable": false + } + ], + "time_index": null, + "unique_keys": [ + [ + 0 + ] + ] + }, + "producer": 4, + "role": "Input", + "window": "NotApplicable" + } + ], + "nodes": [ + { + "id": 0, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "host", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 4, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Scan": { + "predicates": [], + "schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "host", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 4, + 0 + ] + ] + }, + "source": { + "TimeSeries": { + "metric": "data" + } + } + } + } + }, + "retention_ms": 15000 + }, + { + "id": 1, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "host", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 4, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "TimeRange": { + "child": 0, + "kind": "instant", + "range": { + "nanos": 0, + "secs": 15 + } + } + } + } + }, + { + "id": 2, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "utf8" + }, + "name": "host", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "ExactAggregate": [ + "Sum", + "Sum" + ] + }, + "name": "state", + "nullable": false + } + ], + "time_index": null, + "unique_keys": [ + [ + 0, + 1 + ] + ] + }, + "output_state": { + "primitive": "SummaryState", + "timing": "query_time" + }, + "payload": { + "ASAP": { + "SummaryAgg": { + "child": 1, + "filter": null, + "input": { + "item": null, + "weight": { + "Column": "SampleValue" + } + }, + "reduction": { + "Reduce": [ + 2, + 3 + ] + }, + "summary_type": { + "ExactAggregate": [ + "Sum", + "Sum" + ] + } + } + } + } + }, + { + "id": 3, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "utf8" + }, + "name": "host", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "sum", + "nullable": false + } + ], + "time_index": null, + "unique_keys": [ + [ + 0, + 1 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "ASAP": { + "FinalizeExactAccumulator": { + "child": 2 + } + } + } + }, + { + "id": 4, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "sum", + "nullable": false + } + ], + "time_index": null, + "unique_keys": [ + [ + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Aggregate": { + "child": 3, + "filters": [], + "having": null, + "measures": [ + { + "col": 2, + "kind": "sum" + } + ], + "output_names": [ + "sum" + ], + "reduction": { + "Reduce": [ + 1 + ] + } + } + } + } + }, + { + "id": 5, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "float64" + }, + "name": "sum", + "nullable": false + } + ], + "time_index": null, + "unique_keys": [] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Aggregate": { + "child": 4, + "filters": [], + "having": null, + "measures": [ + { + "col": 1, + "kind": "sum" + } + ], + "output_names": [ + "sum" + ], + "reduction": { + "Reduce": [] + } + } + } + } + } + ], + "roots": [ + 4, + 3, + 5 + ], + "scalar_roots": [] + } + } +} diff --git a/crates/devtools/tests/sketch_plan_snapshots/sign-non-negative-raw-retained.json b/crates/devtools/tests/sketch_plan_snapshots/sign-non-negative-raw-retained.json new file mode 100644 index 000000000..2a9762233 --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/sign-non-negative-raw-retained.json @@ -0,0 +1,592 @@ +{ + "accuracy_guarantees": "enforced", + "materialized_views": [], + "queries": [ + "quantile_over_time(0.9, data[5m])", + "topk(5, sum_over_time(data[5m]))" + ], + "selected": { + "accepted": [ + { + "accepted_metric": null, + "sketches": [], + "summary": "accepted exact" + }, + { + "accepted_metric": null, + "sketches": [], + "summary": "accepted exact" + } + ], + "cost": { + "cost_per_second": 2.52146718456e-8, + "cpu_core_seconds_per_second": 0.00224221116667, + "per_node": { + "0": { + "cost_per_second": 1.57416000515e-10, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.000014, + "detail": "scan 200000 samples; x 0.0167/s; holds 32 bytes for 0.840 ms; keeps 6400000 bytes of raw data on disk", + "multiplier": 1, + "operator": "Scan", + "timing": "query_time" + }, + "1": { + "cost_per_second": 4.125499097e-10, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.0000366666666667, + "detail": "time range 300s: keep 200000 of 200000 rows; x 0.0167/s; holds 6400000 bytes for 2.200 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "2": { + "cost_per_second": 1.1806683077e-8, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.00105, + "detail": "hash aggregate 200000 rows into 10000 groups: 20 ops per row, 200000 group visits; x 0.0167/s; holds 400000 bytes for 63.000 ms", + "multiplier": 1, + "operator": "Aggregate", + "timing": "query_time" + }, + "3": { + "cost_per_second": 1.29807420476e-10, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.0000115445, + "detail": "hash aggregate 10000 rows into 1 groups: 69 ops per row, 1 group visits; x 0.0167/s; holds 80016 bytes for 0.693 ms", + "multiplier": 1, + "operator": "Aggregate", + "timing": "query_time" + }, + "4": { + "cost_per_second": 1.27082154379e-8, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.00113, + "detail": "hash aggregate 200000 rows into 10000 groups: 44 ops per row, 200000 group visits; x 0.0167/s; holds 1920000 bytes for 67.800 ms", + "multiplier": 1, + "operator": "Aggregate", + "timing": "query_time" + } + }, + "source": "analytical-cost-v2 (illustrative statistics)", + "usage": { + "average_memory_bytes": 2825.19085938, + "cpu_ops_per_second": 2231544.5, + "disk_bytes": 6400000, + "peak_cpu_cores": 2, + "peak_memory_bytes": 8800048, + "scanned_bytes_per_second": 106666.666667 + } + }, + "dag": { + "edges": [ + { + "consumer": 1, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 0, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 2, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 1, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 3, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 2, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 4, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 1, + "role": "Input", + "window": "NotApplicable" + } + ], + "nodes": [ + { + "id": 0, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Scan": { + "predicates": [], + "schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "source": { + "TimeSeries": { + "metric": "data" + } + } + } + } + }, + "retention_ms": 300000 + }, + { + "id": 1, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "TimeRange": { + "child": 0, + "kind": "range", + "range": { + "nanos": 0, + "secs": 300 + } + } + } + } + }, + { + "id": 2, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Aggregate": { + "child": 1, + "filters": [], + "having": null, + "measures": [ + { + "col": null, + "kind": "sum" + } + ], + "output_names": [ + "" + ], + "reduction": "PerEntity" + } + } + } + }, + { + "id": 3, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "float64" + }, + "name": "topk_5", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": null, + "unique_keys": [ + [ + 1 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Aggregate": { + "child": 2, + "filters": [], + "having": null, + "measures": [ + { + "k": 5, + "kind": "top_k" + } + ], + "output_names": [ + "" + ], + "reduction": { + "Reduce": [] + } + } + } + } + }, + { + "id": 4, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Aggregate": { + "child": 1, + "filters": [], + "having": null, + "measures": [ + { + "col": null, + "kind": "quantile", + "q": 0.9 + } + ], + "output_names": [ + "" + ], + "reduction": "PerEntity" + } + } + } + } + ], + "roots": [ + 4, + 3 + ], + "scalar_roots": [] + } + } +} diff --git a/crates/devtools/tests/sketch_plan_snapshots/sign-unknown-raw-retained.json b/crates/devtools/tests/sketch_plan_snapshots/sign-unknown-raw-retained.json new file mode 100644 index 000000000..2a9762233 --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/sign-unknown-raw-retained.json @@ -0,0 +1,592 @@ +{ + "accuracy_guarantees": "enforced", + "materialized_views": [], + "queries": [ + "quantile_over_time(0.9, data[5m])", + "topk(5, sum_over_time(data[5m]))" + ], + "selected": { + "accepted": [ + { + "accepted_metric": null, + "sketches": [], + "summary": "accepted exact" + }, + { + "accepted_metric": null, + "sketches": [], + "summary": "accepted exact" + } + ], + "cost": { + "cost_per_second": 2.52146718456e-8, + "cpu_core_seconds_per_second": 0.00224221116667, + "per_node": { + "0": { + "cost_per_second": 1.57416000515e-10, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.000014, + "detail": "scan 200000 samples; x 0.0167/s; holds 32 bytes for 0.840 ms; keeps 6400000 bytes of raw data on disk", + "multiplier": 1, + "operator": "Scan", + "timing": "query_time" + }, + "1": { + "cost_per_second": 4.125499097e-10, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.0000366666666667, + "detail": "time range 300s: keep 200000 of 200000 rows; x 0.0167/s; holds 6400000 bytes for 2.200 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "2": { + "cost_per_second": 1.1806683077e-8, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.00105, + "detail": "hash aggregate 200000 rows into 10000 groups: 20 ops per row, 200000 group visits; x 0.0167/s; holds 400000 bytes for 63.000 ms", + "multiplier": 1, + "operator": "Aggregate", + "timing": "query_time" + }, + "3": { + "cost_per_second": 1.29807420476e-10, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.0000115445, + "detail": "hash aggregate 10000 rows into 1 groups: 69 ops per row, 1 group visits; x 0.0167/s; holds 80016 bytes for 0.693 ms", + "multiplier": 1, + "operator": "Aggregate", + "timing": "query_time" + }, + "4": { + "cost_per_second": 1.27082154379e-8, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.00113, + "detail": "hash aggregate 200000 rows into 10000 groups: 44 ops per row, 200000 group visits; x 0.0167/s; holds 1920000 bytes for 67.800 ms", + "multiplier": 1, + "operator": "Aggregate", + "timing": "query_time" + } + }, + "source": "analytical-cost-v2 (illustrative statistics)", + "usage": { + "average_memory_bytes": 2825.19085938, + "cpu_ops_per_second": 2231544.5, + "disk_bytes": 6400000, + "peak_cpu_cores": 2, + "peak_memory_bytes": 8800048, + "scanned_bytes_per_second": 106666.666667 + } + }, + "dag": { + "edges": [ + { + "consumer": 1, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 0, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 2, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 1, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 3, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 2, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 4, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 1, + "role": "Input", + "window": "NotApplicable" + } + ], + "nodes": [ + { + "id": 0, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Scan": { + "predicates": [], + "schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "source": { + "TimeSeries": { + "metric": "data" + } + } + } + } + }, + "retention_ms": 300000 + }, + { + "id": 1, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "TimeRange": { + "child": 0, + "kind": "range", + "range": { + "nanos": 0, + "secs": 300 + } + } + } + } + }, + { + "id": 2, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Aggregate": { + "child": 1, + "filters": [], + "having": null, + "measures": [ + { + "col": null, + "kind": "sum" + } + ], + "output_names": [ + "" + ], + "reduction": "PerEntity" + } + } + } + }, + { + "id": 3, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "float64" + }, + "name": "topk_5", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": null, + "unique_keys": [ + [ + 1 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Aggregate": { + "child": 2, + "filters": [], + "having": null, + "measures": [ + { + "k": 5, + "kind": "top_k" + } + ], + "output_names": [ + "" + ], + "reduction": { + "Reduce": [] + } + } + } + } + }, + { + "id": 4, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Aggregate": { + "child": 1, + "filters": [], + "having": null, + "measures": [ + { + "col": null, + "kind": "quantile", + "q": 0.9 + } + ], + "output_names": [ + "" + ], + "reduction": "PerEntity" + } + } + } + } + ], + "roots": [ + 4, + 3 + ], + "scalar_roots": [] + } + } +} diff --git a/crates/devtools/tests/sketch_plan_snapshots/sql-rollup-quantile-different-windows-raw-retained.json b/crates/devtools/tests/sketch_plan_snapshots/sql-rollup-quantile-different-windows-raw-retained.json new file mode 100644 index 000000000..768f358a1 --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/sql-rollup-quantile-different-windows-raw-retained.json @@ -0,0 +1,1259 @@ +{ + "accuracy_guarantees": "enforced", + "materialized_views": [ + { + "coverage": { + "definition_id": "a446d509bf79a41e64d4c7dc4e541037", + "selection": [ + { + "columns": [] + } + ] + }, + "inputs": { + "materialized_views": [] + }, + "node_id": 5, + "refresh": "at_ingestion", + "retention_ms": 300000 + } + ], + "planner_executor_error": "the executor cannot refresh materialized view 5 from its inputs: invalid DAG: summary time column must be a timestamp", + "queries": [ + "SELECT job, approx_percentile_cont(value, 0.9) AS value FROM data WHERE ts >= now() - INTERVAL '5 minutes' GROUP BY job", + "SELECT job, host, approx_percentile_cont(value, 0.9) AS value FROM data WHERE ts >= now() - INTERVAL '10 minutes' GROUP BY job, host" + ], + "selected": { + "accepted": [ + { + "accepted_metric": "rank", + "sketches": [ + "Kll" + ], + "summary": "accepted rank (Kll)" + }, + { + "accepted_metric": null, + "sketches": [], + "summary": "accepted exact" + } + ], + "cost": { + "cost_per_second": 2.66626771562e-8, + "cpu_core_seconds_per_second": 0.00226611296667, + "per_node": { + "0": { + "cost_per_second": 4.34768002135e-10, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.0000386666666667, + "detail": "scan 400000 samples; x 0.0167/s; holds 48 bytes for 2.320 ms; keeps 19200000 bytes of raw data on disk", + "multiplier": 1, + "operator": "Scan", + "timing": "query_time" + }, + "1": { + "cost_per_second": 8.24560004049e-10, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.0000733333333333, + "detail": "time range 600s: keep 400000 of 400000 rows; x 0.0167/s; holds 48 bytes for 4.400 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "10": { + "cost_per_second": 1.8740000046e-15, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-10, + "detail": "operator: pass 10 rows; x 0.0167/s; holds 24 bytes for 0.000 ms", + "multiplier": 1, + "operator": "Project", + "timing": "query_time" + }, + "2": { + "cost_per_second": 2.32838416369e-8, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.00207, + "detail": "hash aggregate 400000 rows into 10000 groups: 77 ops per row, 400000 group visits; x 0.0167/s; holds 3680000 bytes for 124.200 ms", + "multiplier": 1, + "operator": "Aggregate", + "timing": "query_time" + }, + "3": { + "cost_per_second": 1.87400000767e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-7, + "detail": "operator: pass 10000 rows; x 0.0167/s; holds 40 bytes for 0.010 ms", + "multiplier": 1, + "operator": "Project", + "timing": "query_time" + }, + "4": { + "cost_per_second": 4.34985384e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 3.8686e-6, + "detail": "scan 667 samples; x 1.0000/s", + "multiplier": 1, + "operator": "Scan", + "timing": "ingestion_time" + }, + "5": { + "cost_per_second": 1.91531091927e-9, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.0000659526666667, + "detail": "build Kll in tumbling windows of 60000 ms for 10 groups: 667 rows x 84 ops, 1 group visits, 0.2 states emitted; x 1.0000/s; keeps 1020480 bytes", + "multiplier": 1, + "operator": "SummaryTumblingWindowChain", + "timing": "ingestion_time" + }, + "6": { + "cost_per_second": 1.03070179321e-13, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 9.16666666667e-9, + "detail": "time range 300s: 5 tumbling windows of states; x 0.0167/s; holds 17008 bytes for 0.001 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "7": { + "cost_per_second": 1.2538702282e-10, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.0000111512666667, + "detail": "merge 50 states into 10; x 0.0167/s; holds 170000 bytes for 0.669 ms", + "multiplier": 1, + "operator": "SummaryMerge", + "timing": "query_time" + }, + "8": { + "cost_per_second": 3.33302144e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 2.96426666667e-6, + "detail": "estimate 10 groups x 1; x 0.0167/s", + "multiplier": 1, + "operator": "SummaryEstimate", + "timing": "query_time" + }, + "9": { + "cost_per_second": 1.8740000046e-15, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-10, + "detail": "operator: pass 10 rows; x 0.0167/s; holds 24 bytes for 0.000 ms", + "multiplier": 1, + "operator": "Project", + "timing": "query_time" + } + }, + "source": "analytical-cost-v2 (illustrative statistics)", + "usage": { + "average_memory_bytes": 1028099.50125, + "cpu_ops_per_second": 2230911.36667, + "disk_bytes": 19200000, + "peak_cpu_cores": 3, + "peak_memory_bytes": 4887720, + "scanned_bytes_per_second": 352016.0 + } + }, + "dag": { + "edges": [ + { + "consumer": 1, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "host", + "nullable": true + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": true + } + ], + "time_index": 0, + "unique_keys": [] + }, + "producer": 0, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 2, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "host", + "nullable": true + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": true + } + ], + "time_index": 0, + "unique_keys": [] + }, + "producer": 1, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 3, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "host", + "nullable": true + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "approx_percentile_cont(data.value,Float64(0.9))", + "nullable": true + } + ], + "time_index": null, + "unique_keys": [ + [ + 0, + 1 + ] + ] + }, + "producer": 2, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 5, + "data_state": { + "primitive": "Raw", + "timing": "ingestion_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "host", + "nullable": true + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": true + } + ], + "time_index": 0, + "unique_keys": [] + }, + "producer": 4, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 6, + "data_state": { + "primitive": "SummaryState", + "timing": "ingestion_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "window_end", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Sketch": "Kll" + }, + "name": "state", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 0, + 1 + ] + ] + }, + "producer": 5, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 7, + "data_state": { + "primitive": "SummaryState", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "window_end", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Sketch": "Kll" + }, + "name": "state", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 0, + 1 + ] + ] + }, + "producer": 6, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 8, + "data_state": { + "primitive": "SummaryState", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Sketch": "Kll" + }, + "name": "state", + "nullable": false + } + ], + "time_index": null, + "unique_keys": [ + [ + 0 + ] + ] + }, + "producer": 7, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 9, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "quantile", + "nullable": true + } + ], + "time_index": null, + "unique_keys": [ + [ + 0 + ] + ] + }, + "producer": 8, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 10, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "approx_percentile_cont(data.value,Float64(0.9))", + "nullable": true + } + ], + "time_index": null, + "unique_keys": [ + [ + 0 + ] + ] + }, + "producer": 9, + "role": "Input", + "window": "NotApplicable" + } + ], + "nodes": [ + { + "id": 0, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "host", + "nullable": true + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": true + } + ], + "time_index": 0, + "unique_keys": [] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Scan": { + "predicates": [], + "schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "host", + "nullable": true + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": true + } + ], + "time_index": 0, + "unique_keys": [] + }, + "source": { + "Table": { + "table_ref": "data" + } + } + } + } + }, + "retention_ms": 600000 + }, + { + "id": 1, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "host", + "nullable": true + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": true + } + ], + "time_index": 0, + "unique_keys": [] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "TimeRange": { + "child": 0, + "kind": "range", + "range": { + "nanos": 0, + "secs": 600 + } + } + } + } + }, + { + "id": 2, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "host", + "nullable": true + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "approx_percentile_cont(data.value,Float64(0.9))", + "nullable": true + } + ], + "time_index": null, + "unique_keys": [ + [ + 0, + 1 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Aggregate": { + "child": 1, + "filters": [], + "having": null, + "measures": [ + { + "col": 3, + "kind": "quantile", + "q": 0.9 + } + ], + "output_names": [ + "approx_percentile_cont(data.value,Float64(0.9))" + ], + "reduction": { + "Reduce": [ + 1, + 2 + ] + } + } + } + } + }, + { + "id": 3, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "host", + "nullable": true + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": true + } + ], + "time_index": null, + "unique_keys": [ + [ + 0, + 1 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Project": { + "child": 2, + "cols": [ + { + "alias": null, + "expr": { + "Column": 0 + } + }, + { + "alias": null, + "expr": { + "Column": 1 + } + }, + { + "alias": "value", + "expr": { + "Column": 2 + } + } + ] + } + } + } + }, + { + "id": 4, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "host", + "nullable": true + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": true + } + ], + "time_index": 0, + "unique_keys": [] + }, + "output_state": { + "primitive": "Raw", + "timing": "ingestion_time" + }, + "payload": { + "NonASAP": { + "Scan": { + "predicates": [], + "schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "host", + "nullable": true + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": true + } + ], + "time_index": 0, + "unique_keys": [] + }, + "source": { + "Table": { + "table_ref": "data" + } + } + } + } + } + }, + { + "id": 5, + "lifetime": { + "AcrossEvaluations": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "window_end", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Sketch": "Kll" + }, + "name": "state", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 0, + 1 + ] + ] + }, + "output_state": { + "primitive": "SummaryState", + "timing": "ingestion_time" + }, + "parameters": { + "Kll": { + "k": 547 + } + }, + "payload": { + "ASAP": { + "SummaryTumblingWindowChain": { + "child": 4, + "filter": null, + "input": { + "item": null, + "weight": { + "Column": { + "Named": "value" + } + } + }, + "reduction": { + "Reduce": [ + 1 + ] + }, + "summary_type": { + "Sketch": "Kll" + }, + "tumbling_window_width_ms": 60000 + } + } + }, + "retention_ms": 300000, + "view_coverage": { + "definition_id": "a446d509bf79a41e64d4c7dc4e541037", + "selection": [ + { + "columns": [] + } + ] + } + }, + { + "id": 6, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "window_end", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Sketch": "Kll" + }, + "name": "state", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 0, + 1 + ] + ] + }, + "output_state": { + "primitive": "SummaryState", + "timing": "query_time" + }, + "parameters": { + "Kll": { + "k": 547 + } + }, + "payload": { + "NonASAP": { + "TimeRange": { + "child": 5, + "kind": "range", + "range": { + "nanos": 0, + "secs": 300 + } + } + } + } + }, + { + "id": 7, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Sketch": "Kll" + }, + "name": "state", + "nullable": false + } + ], + "time_index": null, + "unique_keys": [ + [ + 0 + ] + ] + }, + "output_state": { + "primitive": "SummaryState", + "timing": "query_time" + }, + "parameters": { + "Kll": { + "k": 547 + } + }, + "payload": { + "ASAP": { + "SummaryMerge": { + "children": [ + 6 + ] + } + } + } + }, + { + "id": 8, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "quantile", + "nullable": true + } + ], + "time_index": null, + "unique_keys": [ + [ + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "ASAP": { + "SummaryEstimate": { + "query": { + "Quantile": { + "q": 0.9 + } + }, + "summary_input": 7 + } + } + } + }, + { + "id": 9, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "approx_percentile_cont(data.value,Float64(0.9))", + "nullable": true + } + ], + "time_index": null, + "unique_keys": [ + [ + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Project": { + "child": 8, + "cols": [ + { + "alias": "job", + "expr": { + "Column": 0 + } + }, + { + "alias": "approx_percentile_cont(data.value,Float64(0.9))", + "expr": { + "Column": 1 + } + } + ] + } + } + } + }, + { + "id": 10, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": true + } + ], + "time_index": null, + "unique_keys": [ + [ + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Project": { + "child": 9, + "cols": [ + { + "alias": null, + "expr": { + "Column": 0 + } + }, + { + "alias": "value", + "expr": { + "Column": 1 + } + } + ] + } + } + } + } + ], + "roots": [ + 10, + 3 + ], + "scalar_roots": [] + } + } +} diff --git a/crates/devtools/tests/sketch_plan_snapshots/sql-rollup-quantile-same-window-raw-retained.json b/crates/devtools/tests/sketch_plan_snapshots/sql-rollup-quantile-same-window-raw-retained.json new file mode 100644 index 000000000..5adbb5169 --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/sql-rollup-quantile-same-window-raw-retained.json @@ -0,0 +1,1261 @@ +{ + "accuracy_guarantees": "enforced", + "materialized_views": [ + { + "coverage": { + "definition_id": "a446d509bf79a41e64d4c7dc4e541037", + "selection": [ + { + "columns": [] + } + ] + }, + "inputs": { + "materialized_views": [] + }, + "node_id": 5, + "refresh": "at_ingestion", + "retention_ms": 300000 + } + ], + "planner_executor_error": "the executor cannot refresh materialized view 5 from its inputs: invalid DAG: summary time column must be a timestamp", + "queries": [ + "SELECT job, approx_percentile_cont(value, 0.9) AS value FROM data WHERE ts >= now() - INTERVAL '5 minutes' GROUP BY job", + "SELECT job, host, approx_percentile_cont(value, 0.9) AS value FROM data WHERE ts >= now() - INTERVAL '5 minutes' GROUP BY job, host" + ], + "selected": { + "accepted": [ + { + "accepted_metric": "rank", + "sketches": [ + "Kll" + ], + "summary": "accepted rank (Kll)" + }, + { + "accepted_metric": null, + "sketches": [], + "summary": "accepted exact" + } + ], + "cost": { + "cost_per_second": 1.65072582049e-8, + "cpu_core_seconds_per_second": 0.0013634463, + "per_node": { + "0": { + "cost_per_second": 2.17384001067e-10, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.0000193333333333, + "detail": "scan 200000 samples; x 0.0167/s; holds 48 bytes for 1.160 ms; keeps 9600000 bytes of raw data on disk", + "multiplier": 1, + "operator": "Scan", + "timing": "query_time" + }, + "1": { + "cost_per_second": 4.12280002024e-10, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.0000366666666667, + "detail": "time range 300s: keep 200000 of 200000 rows; x 0.0167/s; holds 48 bytes for 2.200 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "10": { + "cost_per_second": 1.8740000046e-15, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-10, + "detail": "operator: pass 10 rows; x 0.0167/s; holds 24 bytes for 0.000 ms", + "multiplier": 1, + "operator": "Project", + "timing": "query_time" + }, + "2": { + "cost_per_second": 1.37580866799e-8, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.00122333333333, + "detail": "hash aggregate 200000 rows into 10000 groups: 72 ops per row, 200000 group visits; x 0.0167/s; holds 2080000 bytes for 73.400 ms", + "multiplier": 1, + "operator": "Aggregate", + "timing": "query_time" + }, + "3": { + "cost_per_second": 1.87400000767e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-7, + "detail": "operator: pass 10000 rows; x 0.0167/s; holds 40 bytes for 0.010 ms", + "multiplier": 1, + "operator": "Project", + "timing": "query_time" + }, + "4": { + "cost_per_second": 4.34985384e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 3.8686e-6, + "detail": "scan 667 samples; x 1.0000/s", + "multiplier": 1, + "operator": "Scan", + "timing": "ingestion_time" + }, + "5": { + "cost_per_second": 1.91531091927e-9, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.0000659526666667, + "detail": "build Kll in tumbling windows of 60000 ms for 10 groups: 667 rows x 84 ops, 1 group visits, 0.2 states emitted; x 1.0000/s; keeps 1020480 bytes", + "multiplier": 1, + "operator": "SummaryTumblingWindowChain", + "timing": "ingestion_time" + }, + "6": { + "cost_per_second": 1.03078966063e-13, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 9.16666666667e-9, + "detail": "time range 300s: 5 tumbling windows of states; x 0.0167/s; holds 850400 bytes for 0.001 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "7": { + "cost_per_second": 1.2538702282e-10, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.0000111512666667, + "detail": "merge 50 states into 10; x 0.0167/s; holds 170000 bytes for 0.669 ms", + "multiplier": 1, + "operator": "SummaryMerge", + "timing": "query_time" + }, + "8": { + "cost_per_second": 3.33302144e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 2.96426666667e-6, + "detail": "estimate 10 groups x 1; x 0.0167/s", + "multiplier": 1, + "operator": "SummaryEstimate", + "timing": "query_time" + }, + "9": { + "cost_per_second": 1.8740000046e-15, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-10, + "detail": "operator: pass 10 rows; x 0.0167/s; holds 24 bytes for 0.000 ms", + "multiplier": 1, + "operator": "Project", + "timing": "query_time" + } + }, + "source": "analytical-cost-v2 (illustrative statistics)", + "usage": { + "average_memory_bytes": 1023026.43954, + "cpu_ops_per_second": 1344244.7, + "disk_bytes": 9600000, + "peak_cpu_cores": 3, + "peak_memory_bytes": 4121112, + "scanned_bytes_per_second": 192016.0 + } + }, + "dag": { + "edges": [ + { + "consumer": 1, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "host", + "nullable": true + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": true + } + ], + "time_index": 0, + "unique_keys": [] + }, + "producer": 0, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 2, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "host", + "nullable": true + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": true + } + ], + "time_index": 0, + "unique_keys": [] + }, + "producer": 1, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 3, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "host", + "nullable": true + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "approx_percentile_cont(data.value,Float64(0.9))", + "nullable": true + } + ], + "time_index": null, + "unique_keys": [ + [ + 0, + 1 + ] + ] + }, + "producer": 2, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 5, + "data_state": { + "primitive": "Raw", + "timing": "ingestion_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "host", + "nullable": true + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": true + } + ], + "time_index": 0, + "unique_keys": [] + }, + "producer": 4, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 6, + "data_state": { + "primitive": "SummaryState", + "timing": "ingestion_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "window_end", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Sketch": "Kll" + }, + "name": "state", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 0, + 1 + ] + ] + }, + "producer": 5, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 7, + "data_state": { + "primitive": "SummaryState", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "window_end", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Sketch": "Kll" + }, + "name": "state", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 0, + 1 + ] + ] + }, + "producer": 6, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 8, + "data_state": { + "primitive": "SummaryState", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Sketch": "Kll" + }, + "name": "state", + "nullable": false + } + ], + "time_index": null, + "unique_keys": [ + [ + 0 + ] + ] + }, + "producer": 7, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 9, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "quantile", + "nullable": true + } + ], + "time_index": null, + "unique_keys": [ + [ + 0 + ] + ] + }, + "producer": 8, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 10, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "approx_percentile_cont(data.value,Float64(0.9))", + "nullable": true + } + ], + "time_index": null, + "unique_keys": [ + [ + 0 + ] + ] + }, + "producer": 9, + "role": "Input", + "window": "NotApplicable" + } + ], + "nodes": [ + { + "id": 0, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "host", + "nullable": true + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": true + } + ], + "time_index": 0, + "unique_keys": [] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Scan": { + "predicates": [], + "schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "host", + "nullable": true + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": true + } + ], + "time_index": 0, + "unique_keys": [] + }, + "source": { + "Table": { + "table_ref": "data" + } + } + } + } + }, + "retention_ms": 300000 + }, + { + "id": 1, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "host", + "nullable": true + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": true + } + ], + "time_index": 0, + "unique_keys": [] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "TimeRange": { + "child": 0, + "kind": "range", + "range": { + "nanos": 0, + "secs": 300 + } + } + } + } + }, + { + "id": 2, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "host", + "nullable": true + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "approx_percentile_cont(data.value,Float64(0.9))", + "nullable": true + } + ], + "time_index": null, + "unique_keys": [ + [ + 0, + 1 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Aggregate": { + "child": 1, + "filters": [], + "having": null, + "measures": [ + { + "col": 3, + "kind": "quantile", + "q": 0.9 + } + ], + "output_names": [ + "approx_percentile_cont(data.value,Float64(0.9))" + ], + "reduction": { + "Reduce": [ + 1, + 2 + ] + } + } + } + } + }, + { + "id": 3, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "host", + "nullable": true + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": true + } + ], + "time_index": null, + "unique_keys": [ + [ + 0, + 1 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Project": { + "child": 2, + "cols": [ + { + "alias": null, + "expr": { + "Column": 0 + } + }, + { + "alias": null, + "expr": { + "Column": 1 + } + }, + { + "alias": "value", + "expr": { + "Column": 2 + } + } + ] + } + } + } + }, + { + "id": 4, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "host", + "nullable": true + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": true + } + ], + "time_index": 0, + "unique_keys": [] + }, + "output_state": { + "primitive": "Raw", + "timing": "ingestion_time" + }, + "payload": { + "NonASAP": { + "Scan": { + "predicates": [], + "schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "host", + "nullable": true + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": true + } + ], + "time_index": 0, + "unique_keys": [] + }, + "source": { + "Table": { + "table_ref": "data" + } + } + } + } + } + }, + { + "id": 5, + "lifetime": { + "AcrossEvaluations": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "window_end", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Sketch": "Kll" + }, + "name": "state", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 0, + 1 + ] + ] + }, + "output_state": { + "primitive": "SummaryState", + "timing": "ingestion_time" + }, + "parameters": { + "Kll": { + "k": 547 + } + }, + "payload": { + "ASAP": { + "SummaryTumblingWindowChain": { + "child": 4, + "filter": null, + "input": { + "item": null, + "weight": { + "Column": { + "Named": "value" + } + } + }, + "reduction": { + "Reduce": [ + 1 + ] + }, + "summary_type": { + "Sketch": "Kll" + }, + "tumbling_window_width_ms": 60000 + } + } + }, + "retention_ms": 300000, + "view_coverage": { + "definition_id": "a446d509bf79a41e64d4c7dc4e541037", + "selection": [ + { + "columns": [] + } + ] + } + }, + { + "id": 6, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "window_end", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Sketch": "Kll" + }, + "name": "state", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 0, + 1 + ] + ] + }, + "output_state": { + "primitive": "SummaryState", + "timing": "query_time" + }, + "parameters": { + "Kll": { + "k": 547 + } + }, + "payload": { + "NonASAP": { + "TimeRange": { + "child": 5, + "kind": "range", + "range": { + "nanos": 0, + "secs": 300 + } + } + } + } + }, + { + "id": 7, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Sketch": "Kll" + }, + "name": "state", + "nullable": false + } + ], + "time_index": null, + "unique_keys": [ + [ + 0 + ] + ] + }, + "output_state": { + "primitive": "SummaryState", + "timing": "query_time" + }, + "parameters": { + "Kll": { + "k": 547 + } + }, + "payload": { + "ASAP": { + "SummaryMerge": { + "children": [ + 6 + ] + } + } + } + }, + { + "id": 8, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "quantile", + "nullable": true + } + ], + "time_index": null, + "unique_keys": [ + [ + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "ASAP": { + "SummaryEstimate": { + "query": { + "Quantile": { + "q": 0.9 + } + }, + "summary_input": 7 + } + } + } + }, + { + "id": 9, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "approx_percentile_cont(data.value,Float64(0.9))", + "nullable": true + } + ], + "time_index": null, + "unique_keys": [ + [ + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Project": { + "child": 8, + "cols": [ + { + "alias": "job", + "expr": { + "Column": 0 + } + }, + { + "alias": "approx_percentile_cont(data.value,Float64(0.9))", + "expr": { + "Column": 1 + } + } + ] + } + } + } + }, + { + "id": 10, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": true + } + ], + "time_index": null, + "unique_keys": [ + [ + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Project": { + "child": 9, + "cols": [ + { + "alias": null, + "expr": { + "Column": 0 + } + }, + { + "alias": "value", + "expr": { + "Column": 1 + } + } + ] + } + } + } + } + ], + "roots": [ + 10, + 3 + ], + "scalar_roots": [] + } + } +} diff --git a/crates/devtools/tests/sketch_plan_snapshots/stddev-nested-labels-raw-retained.json b/crates/devtools/tests/sketch_plan_snapshots/stddev-nested-labels-raw-retained.json new file mode 100644 index 000000000..ed26c802e --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/stddev-nested-labels-raw-retained.json @@ -0,0 +1,790 @@ +{ + "accuracy_guarantees": "enforced", + "materialized_views": [], + "queries": [ + "stddev by (job) (data)", + "stddev by (job, host) (data)" + ], + "selected": { + "accepted": [ + { + "accepted_metric": null, + "sketches": [], + "summary": "accepted exact" + }, + { + "accepted_metric": null, + "sketches": [], + "summary": "accepted exact" + } + ], + "cost": { + "cost_per_second": 5.20243145064e-9, + "cpu_core_seconds_per_second": 0.000462659166667, + "per_node": { + "0": { + "cost_per_second": 1.08692000534e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 9.66666666667e-7, + "detail": "scan 10000 samples; x 0.0167/s; holds 48 bytes for 0.058 ms", + "multiplier": 1, + "operator": "Scan", + "timing": "query_time" + }, + "1": { + "cost_per_second": 2.06140001012e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.83333333333e-6, + "detail": "time range 15s: keep 10000 of 10000 rows; x 0.0167/s; holds 48 bytes for 0.110 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "2": { + "cost_per_second": 4.26428717448e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 3.7925e-6, + "detail": "hash aggregate 10000 rows into 10 groups: 20 ops per row, 15 group visits; x 0.0167/s; holds 400 bytes for 0.228 ms", + "multiplier": 1, + "operator": "Aggregate", + "timing": "query_time" + }, + "3": { + "cost_per_second": 1.38676000908e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.23333333333e-6, + "detail": "scan 10000 samples; x 0.0167/s; holds 64 bytes for 0.074 ms; keeps 640000 bytes of raw data on disk", + "multiplier": 1, + "operator": "Scan", + "timing": "query_time" + }, + "4": { + "cost_per_second": 2.0614000135e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.83333333333e-6, + "detail": "time range 15s: keep 10000 of 10000 rows; x 0.0167/s; holds 64 bytes for 0.110 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "5": { + "cost_per_second": 5.09382377852e-9, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.000453, + "detail": "hash aggregate 10000 rows into 10000 groups: 48 ops per row, 10000 group visits; x 0.0167/s; holds 560000 bytes for 27.180 ms", + "multiplier": 1, + "operator": "Aggregate", + "timing": "query_time" + } + }, + "source": "analytical-cost-v2 (illustrative statistics)", + "usage": { + "average_memory_bytes": 253.681847667, + "cpu_ops_per_second": 460792.5, + "disk_bytes": 640000, + "peak_cpu_cores": 2, + "peak_memory_bytes": 560624, + "scanned_bytes_per_second": 18666.6666667 + } + }, + "dag": { + "edges": [ + { + "consumer": 1, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 3, + 0 + ] + ] + }, + "producer": 0, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 2, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 3, + 0 + ] + ] + }, + "producer": 1, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 4, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "host", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 4, + 0 + ] + ] + }, + "producer": 3, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 5, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "host", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 4, + 0 + ] + ] + }, + "producer": 4, + "role": "Input", + "window": "NotApplicable" + } + ], + "nodes": [ + { + "id": 0, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 3, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Scan": { + "predicates": [], + "schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 3, + 0 + ] + ] + }, + "source": { + "TimeSeries": { + "metric": "data" + } + } + } + } + }, + "retention_ms": 15000 + }, + { + "id": 1, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 3, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "TimeRange": { + "child": 0, + "kind": "instant", + "range": { + "nanos": 0, + "secs": 15 + } + } + } + } + }, + { + "id": 2, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "stddev", + "nullable": false + } + ], + "time_index": null, + "unique_keys": [ + [ + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Aggregate": { + "child": 1, + "filters": [], + "having": null, + "measures": [ + { + "col": null, + "kind": "std_dev", + "population": true + } + ], + "output_names": [ + "" + ], + "reduction": { + "Reduce": [ + 2 + ] + } + } + } + } + }, + { + "id": 3, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "host", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 4, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Scan": { + "predicates": [], + "schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "host", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 4, + 0 + ] + ] + }, + "source": { + "TimeSeries": { + "metric": "data" + } + } + } + } + }, + "retention_ms": 15000 + }, + { + "id": 4, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "host", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 4, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "TimeRange": { + "child": 3, + "kind": "instant", + "range": { + "nanos": 0, + "secs": 15 + } + } + } + } + }, + { + "id": 5, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "utf8" + }, + "name": "host", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "stddev", + "nullable": false + } + ], + "time_index": null, + "unique_keys": [ + [ + 0, + 1 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Aggregate": { + "child": 4, + "filters": [], + "having": null, + "measures": [ + { + "col": null, + "kind": "std_dev", + "population": true + } + ], + "output_names": [ + "" + ], + "reduction": { + "Reduce": [ + 2, + 3 + ] + } + } + } + } + } + ], + "roots": [ + 2, + 5 + ], + "scalar_roots": [] + } + } +} diff --git a/crates/devtools/tests/sketch_plan_snapshots/sum-5m-avg-10m-over-time-raw-retained.json b/crates/devtools/tests/sketch_plan_snapshots/sum-5m-avg-10m-over-time-raw-retained.json new file mode 100644 index 000000000..7110e7edc --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/sum-5m-avg-10m-over-time-raw-retained.json @@ -0,0 +1,588 @@ +{ + "accuracy_guarantees": "enforced", + "materialized_views": [], + "queries": [ + "sum_over_time(data[5m])", + "avg_over_time(data[10m])" + ], + "selected": { + "accepted": [ + { + "accepted_metric": null, + "sketches": [], + "summary": "accepted exact" + }, + { + "accepted_metric": null, + "sketches": [], + "summary": "accepted exact" + } + ], + "cost": { + "cost_per_second": 3.22869417636e-8, + "cpu_core_seconds_per_second": 0.00287133333333, + "per_node": { + "0": { + "cost_per_second": 3.15244225723e-10, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.000028, + "detail": "scan 400000 samples; x 0.0167/s; holds 12800000 bytes for 1.680 ms; keeps 12800000 bytes of raw data on disk", + "multiplier": 1, + "operator": "Scan", + "timing": "query_time" + }, + "1": { + "cost_per_second": 8.24560002699e-10, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.0000733333333333, + "detail": "time range 600s: keep 400000 of 400000 rows; x 0.0167/s; holds 32 bytes for 4.400 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "2": { + "cost_per_second": 1.89281744568e-8, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.00168333333333, + "detail": "hash aggregate 400000 rows into 10000 groups: 20 ops per row, 400000 group visits; x 0.0167/s; holds 400000 bytes for 101.000 ms", + "multiplier": 1, + "operator": "Aggregate", + "timing": "query_time" + }, + "3": { + "cost_per_second": 4.1228000135e-10, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.0000366666666667, + "detail": "time range 300s: keep 200000 of 400000 rows; x 0.0167/s; holds 32 bytes for 2.200 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "4": { + "cost_per_second": 1.1806683077e-8, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.00105, + "detail": "hash aggregate 200000 rows into 10000 groups: 20 ops per row, 200000 group visits; x 0.0167/s; holds 400000 bytes for 63.000 ms", + "multiplier": 1, + "operator": "Aggregate", + "timing": "query_time" + } + }, + "source": "analytical-cost-v2 (illustrative statistics)", + "usage": { + "average_memory_bytes": 1451.73685333, + "cpu_ops_per_second": 2850000.0, + "disk_bytes": 12800000, + "peak_cpu_cores": 2, + "peak_memory_bytes": 13600064, + "scanned_bytes_per_second": 213333.333333 + } + }, + "dag": { + "edges": [ + { + "consumer": 1, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 0, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 2, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 1, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 3, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 0, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 4, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 3, + "role": "Input", + "window": "NotApplicable" + } + ], + "nodes": [ + { + "id": 0, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Scan": { + "predicates": [], + "schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "source": { + "TimeSeries": { + "metric": "data" + } + } + } + } + }, + "retention_ms": 600000 + }, + { + "id": 1, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "TimeRange": { + "child": 0, + "kind": "range", + "range": { + "nanos": 0, + "secs": 600 + } + } + } + } + }, + { + "id": 2, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Aggregate": { + "child": 1, + "filters": [], + "having": null, + "measures": [ + { + "col": null, + "kind": "avg" + } + ], + "output_names": [ + "" + ], + "reduction": "PerEntity" + } + } + } + }, + { + "id": 3, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "TimeRange": { + "child": 0, + "kind": "range", + "range": { + "nanos": 0, + "secs": 300 + } + } + } + } + }, + { + "id": 4, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Aggregate": { + "child": 3, + "filters": [], + "having": null, + "measures": [ + { + "col": null, + "kind": "sum" + } + ], + "output_names": [ + "" + ], + "reduction": "PerEntity" + } + } + } + } + ], + "roots": [ + 4, + 2 + ], + "scalar_roots": [] + } + } +} diff --git a/crates/devtools/tests/sketch_plan_snapshots/sum-avg-over-time-5m-raw-retained.json b/crates/devtools/tests/sketch_plan_snapshots/sum-avg-over-time-5m-raw-retained.json new file mode 100644 index 000000000..56286b1fb --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/sum-avg-over-time-5m-raw-retained.json @@ -0,0 +1,482 @@ +{ + "accuracy_guarantees": "enforced", + "materialized_views": [], + "queries": [ + "sum_over_time(data[5m])", + "avg_over_time(data[5m])" + ], + "selected": { + "accepted": [ + { + "accepted_metric": null, + "sketches": [], + "summary": "accepted exact" + }, + { + "accepted_metric": null, + "sketches": [], + "summary": "accepted exact" + } + ], + "cost": { + "cost_per_second": 2.41833320643e-8, + "cpu_core_seconds_per_second": 0.00215066666667, + "per_node": { + "0": { + "cost_per_second": 1.57416000515e-10, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.000014, + "detail": "scan 200000 samples; x 0.0167/s; holds 32 bytes for 0.840 ms; keeps 6400000 bytes of raw data on disk", + "multiplier": 1, + "operator": "Scan", + "timing": "query_time" + }, + "1": { + "cost_per_second": 4.125499097e-10, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.0000366666666667, + "detail": "time range 300s: keep 200000 of 200000 rows; x 0.0167/s; holds 6400000 bytes for 2.200 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "2": { + "cost_per_second": 1.1806683077e-8, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.00105, + "detail": "hash aggregate 200000 rows into 10000 groups: 20 ops per row, 200000 group visits; x 0.0167/s; holds 400000 bytes for 63.000 ms", + "multiplier": 1, + "operator": "Aggregate", + "timing": "query_time" + }, + "3": { + "cost_per_second": 1.1806683077e-8, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.00105, + "detail": "hash aggregate 200000 rows into 10000 groups: 20 ops per row, 200000 group visits; x 0.0167/s; holds 400000 bytes for 63.000 ms", + "multiplier": 1, + "operator": "Aggregate", + "timing": "query_time" + } + }, + "source": "analytical-cost-v2 (illustrative statistics)", + "usage": { + "average_memory_bytes": 1074.66711467, + "cpu_ops_per_second": 2140000.0, + "disk_bytes": 6400000, + "peak_cpu_cores": 2, + "peak_memory_bytes": 7200032, + "scanned_bytes_per_second": 106666.666667 + } + }, + "dag": { + "edges": [ + { + "consumer": 1, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 0, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 2, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 1, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 3, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 1, + "role": "Input", + "window": "NotApplicable" + } + ], + "nodes": [ + { + "id": 0, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Scan": { + "predicates": [], + "schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "source": { + "TimeSeries": { + "metric": "data" + } + } + } + } + }, + "retention_ms": 300000 + }, + { + "id": 1, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "TimeRange": { + "child": 0, + "kind": "range", + "range": { + "nanos": 0, + "secs": 300 + } + } + } + } + }, + { + "id": 2, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Aggregate": { + "child": 1, + "filters": [], + "having": null, + "measures": [ + { + "col": null, + "kind": "avg" + } + ], + "output_names": [ + "" + ], + "reduction": "PerEntity" + } + } + } + }, + { + "id": 3, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Aggregate": { + "child": 1, + "filters": [], + "having": null, + "measures": [ + { + "col": null, + "kind": "sum" + } + ], + "output_names": [ + "" + ], + "reduction": "PerEntity" + } + } + } + } + ], + "roots": [ + 3, + 2 + ], + "scalar_roots": [] + } + } +} diff --git a/crates/devtools/tests/sketch_plan_snapshots/sum-over-time-two-intervals-raw-retained.json b/crates/devtools/tests/sketch_plan_snapshots/sum-over-time-two-intervals-raw-retained.json new file mode 100644 index 000000000..f9783b802 --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/sum-over-time-two-intervals-raw-retained.json @@ -0,0 +1,682 @@ +{ + "accuracy_guarantees": "enforced", + "materialized_views": [], + "queries": [ + "sum_over_time(data[10m])", + "sum_over_time(data[5m])" + ], + "selected": { + "accepted": [ + { + "accepted_metric": null, + "sketches": [], + "summary": "accepted exact" + }, + { + "accepted_metric": null, + "sketches": [], + "summary": "accepted exact" + } + ], + "cost": { + "cost_per_second": 1.6389892371e-8, + "cpu_core_seconds_per_second": 0.0014576, + "per_node": { + "0": { + "cost_per_second": 6.29664002061e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 5.6e-6, + "detail": "scan 400000 samples; x 0.0033/s; holds 32 bytes for 1.680 ms; keeps 12800000 bytes of raw data on disk", + "multiplier": 1, + "operator": "Scan", + "timing": "query_time" + }, + "1": { + "cost_per_second": 1.6491200054e-10, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.0000146666666667, + "detail": "time range 600s: keep 400000 of 400000 rows; x 0.0033/s; holds 32 bytes for 4.400 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "2": { + "cost_per_second": 3.78563489136e-9, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.000336666666667, + "detail": "hash aggregate 400000 rows into 10000 groups: 20 ops per row, 400000 group visits; x 0.0033/s; holds 400000 bytes for 101.000 ms", + "multiplier": 1, + "operator": "Aggregate", + "timing": "query_time" + }, + "3": { + "cost_per_second": 1.57416000515e-10, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.000014, + "detail": "scan 200000 samples; x 0.0167/s; holds 32 bytes for 0.840 ms", + "multiplier": 1, + "operator": "Scan", + "timing": "query_time" + }, + "4": { + "cost_per_second": 4.1228000135e-10, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.0000366666666667, + "detail": "time range 300s: keep 200000 of 200000 rows; x 0.0167/s; holds 32 bytes for 2.200 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "5": { + "cost_per_second": 1.1806683077e-8, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.00105, + "detail": "hash aggregate 200000 rows into 10000 groups: 20 ops per row, 200000 group visits; x 0.0167/s; holds 400000 bytes for 63.000 ms", + "multiplier": 1, + "operator": "Aggregate", + "timing": "query_time" + } + }, + "source": "analytical-cost-v2 (illustrative statistics)", + "usage": { + "average_memory_bytes": 554.668936533, + "cpu_ops_per_second": 1442666.66667, + "disk_bytes": 12800000, + "peak_cpu_cores": 2, + "peak_memory_bytes": 800128, + "scanned_bytes_per_second": 149333.333333 + } + }, + "dag": { + "edges": [ + { + "consumer": 1, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 0, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 2, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 1, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 4, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 3, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 5, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 4, + "role": "Input", + "window": "NotApplicable" + } + ], + "nodes": [ + { + "id": 0, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Scan": { + "predicates": [], + "schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "source": { + "TimeSeries": { + "metric": "data" + } + } + } + } + }, + "retention_ms": 600000 + }, + { + "id": 1, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "TimeRange": { + "child": 0, + "kind": "range", + "range": { + "nanos": 0, + "secs": 600 + } + } + } + } + }, + { + "id": 2, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Aggregate": { + "child": 1, + "filters": [], + "having": null, + "measures": [ + { + "col": null, + "kind": "sum" + } + ], + "output_names": [ + "" + ], + "reduction": "PerEntity" + } + } + } + }, + { + "id": 3, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Scan": { + "predicates": [], + "schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "source": { + "TimeSeries": { + "metric": "data" + } + } + } + } + }, + "retention_ms": 600000 + }, + { + "id": 4, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "TimeRange": { + "child": 3, + "kind": "range", + "range": { + "nanos": 0, + "secs": 300 + } + } + } + } + }, + { + "id": 5, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Aggregate": { + "child": 4, + "filters": [], + "having": null, + "measures": [ + { + "col": null, + "kind": "sum" + } + ], + "output_names": [ + "" + ], + "reduction": "PerEntity" + } + } + } + } + ], + "roots": [ + 2, + 5 + ], + "scalar_roots": [] + } + } +} diff --git a/crates/devtools/tests/sketch_plan_snapshots/topk-5-and-10-accuracy-raw-retained.json b/crates/devtools/tests/sketch_plan_snapshots/topk-5-and-10-accuracy-raw-retained.json new file mode 100644 index 000000000..15e7ae0da --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/topk-5-and-10-accuracy-raw-retained.json @@ -0,0 +1,573 @@ +{ + "accuracy_guarantees": "enforced", + "materialized_views": [], + "queries": [ + "topk(5, data)", + "topk(10, data)" + ], + "selected": { + "accepted": [ + { + "accepted_metric": null, + "sketches": [], + "summary": "accepted exact" + }, + { + "accepted_metric": null, + "sketches": [], + "summary": "accepted exact" + } + ], + "cost": { + "cost_per_second": 5.47244698969e-11, + "cpu_core_seconds_per_second": 4.86691666667e-6, + "per_node": { + "0": { + "cost_per_second": 7.87080002576e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 7e-7, + "detail": "scan 10000 samples; x 0.0167/s; holds 32 bytes for 0.042 ms; keeps 320000 bytes of raw data on disk", + "multiplier": 1, + "operator": "Scan", + "timing": "query_time" + }, + "1": { + "cost_per_second": 2.06140000675e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.83333333333e-6, + "detail": "time range 15s: keep 10000 of 10000 rows; x 0.0167/s; holds 32 bytes for 0.110 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "2": { + "cost_per_second": 2.62368588036e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 2.33333333333e-6, + "detail": "sort 10000 rows in 1 partitions; x 0.0167/s; holds 320000 bytes for 0.140 ms", + "multiplier": 1, + "operator": "Sort", + "timing": "query_time" + }, + "3": { + "cost_per_second": 1.87400000613e-15, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-10, + "detail": "limit to 10 rows; x 0.0167/s; holds 32 bytes for 0.000 ms", + "multiplier": 1, + "operator": "Limit", + "timing": "query_time" + }, + "4": { + "cost_per_second": 9.37000015336e-16, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 8.33333333333e-11, + "detail": "limit to 5 rows; x 0.0167/s; holds 160 bytes for 0.000 ms", + "multiplier": 1, + "operator": "Limit", + "timing": "query_time" + } + }, + "source": "analytical-cost-v2 (illustrative statistics)", + "usage": { + "average_memory_bytes": 0.746747752, + "cpu_ops_per_second": 4333.58333333, + "disk_bytes": 320000, + "peak_cpu_cores": 2, + "peak_memory_bytes": 320256, + "scanned_bytes_per_second": 5333.33333333 + } + }, + "dag": { + "edges": [ + { + "consumer": 1, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 0, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 2, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 1, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 3, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 2, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 4, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 2, + "role": "Input", + "window": "NotApplicable" + } + ], + "nodes": [ + { + "id": 0, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Scan": { + "predicates": [], + "schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "source": { + "TimeSeries": { + "metric": "data" + } + } + } + } + }, + "retention_ms": 15000 + }, + { + "id": 1, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "TimeRange": { + "child": 0, + "kind": "instant", + "range": { + "nanos": 0, + "secs": 15 + } + } + } + } + }, + { + "id": 2, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Sort": { + "child": 1, + "keys": [ + { + "ascending": false, + "expr": { + "Column": 1 + }, + "nulls_first": false + } + ], + "partition_by": [] + } + } + } + }, + { + "id": 3, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Limit": { + "child": 2, + "n": 10, + "offset": 0, + "partition_by": [] + } + } + } + }, + { + "id": 4, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Limit": { + "child": 2, + "n": 5, + "offset": 0, + "partition_by": [] + } + } + } + } + ], + "roots": [ + 4, + 3 + ], + "scalar_roots": [] + } + } +} diff --git a/crates/devtools/tests/sketch_plan_snapshots/topk-5-and-10-raw-retained.json b/crates/devtools/tests/sketch_plan_snapshots/topk-5-and-10-raw-retained.json new file mode 100644 index 000000000..15e7ae0da --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/topk-5-and-10-raw-retained.json @@ -0,0 +1,573 @@ +{ + "accuracy_guarantees": "enforced", + "materialized_views": [], + "queries": [ + "topk(5, data)", + "topk(10, data)" + ], + "selected": { + "accepted": [ + { + "accepted_metric": null, + "sketches": [], + "summary": "accepted exact" + }, + { + "accepted_metric": null, + "sketches": [], + "summary": "accepted exact" + } + ], + "cost": { + "cost_per_second": 5.47244698969e-11, + "cpu_core_seconds_per_second": 4.86691666667e-6, + "per_node": { + "0": { + "cost_per_second": 7.87080002576e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 7e-7, + "detail": "scan 10000 samples; x 0.0167/s; holds 32 bytes for 0.042 ms; keeps 320000 bytes of raw data on disk", + "multiplier": 1, + "operator": "Scan", + "timing": "query_time" + }, + "1": { + "cost_per_second": 2.06140000675e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.83333333333e-6, + "detail": "time range 15s: keep 10000 of 10000 rows; x 0.0167/s; holds 32 bytes for 0.110 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "2": { + "cost_per_second": 2.62368588036e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 2.33333333333e-6, + "detail": "sort 10000 rows in 1 partitions; x 0.0167/s; holds 320000 bytes for 0.140 ms", + "multiplier": 1, + "operator": "Sort", + "timing": "query_time" + }, + "3": { + "cost_per_second": 1.87400000613e-15, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-10, + "detail": "limit to 10 rows; x 0.0167/s; holds 32 bytes for 0.000 ms", + "multiplier": 1, + "operator": "Limit", + "timing": "query_time" + }, + "4": { + "cost_per_second": 9.37000015336e-16, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 8.33333333333e-11, + "detail": "limit to 5 rows; x 0.0167/s; holds 160 bytes for 0.000 ms", + "multiplier": 1, + "operator": "Limit", + "timing": "query_time" + } + }, + "source": "analytical-cost-v2 (illustrative statistics)", + "usage": { + "average_memory_bytes": 0.746747752, + "cpu_ops_per_second": 4333.58333333, + "disk_bytes": 320000, + "peak_cpu_cores": 2, + "peak_memory_bytes": 320256, + "scanned_bytes_per_second": 5333.33333333 + } + }, + "dag": { + "edges": [ + { + "consumer": 1, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 0, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 2, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 1, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 3, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 2, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 4, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 2, + "role": "Input", + "window": "NotApplicable" + } + ], + "nodes": [ + { + "id": 0, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Scan": { + "predicates": [], + "schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "source": { + "TimeSeries": { + "metric": "data" + } + } + } + } + }, + "retention_ms": 15000 + }, + { + "id": 1, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "TimeRange": { + "child": 0, + "kind": "instant", + "range": { + "nanos": 0, + "secs": 15 + } + } + } + } + }, + { + "id": 2, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Sort": { + "child": 1, + "keys": [ + { + "ascending": false, + "expr": { + "Column": 1 + }, + "nulls_first": false + } + ], + "partition_by": [] + } + } + } + }, + { + "id": 3, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Limit": { + "child": 2, + "n": 10, + "offset": 0, + "partition_by": [] + } + } + } + }, + { + "id": 4, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Limit": { + "child": 2, + "n": 5, + "offset": 0, + "partition_by": [] + } + } + } + } + ], + "roots": [ + 4, + 3 + ], + "scalar_roots": [] + } + } +} diff --git a/crates/devtools/tests/sketch_plan_snapshots/topk-by-job-and-global-raw-retained.json b/crates/devtools/tests/sketch_plan_snapshots/topk-by-job-and-global-raw-retained.json new file mode 100644 index 000000000..5f7f83b20 --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/topk-by-job-and-global-raw-retained.json @@ -0,0 +1,944 @@ +{ + "accuracy_guarantees": "enforced", + "materialized_views": [], + "queries": [ + "topk by (job) (5, data)", + "topk(10, data)" + ], + "selected": { + "accepted": [ + { + "accepted_metric": null, + "sketches": [], + "summary": "accepted exact" + }, + { + "accepted_metric": null, + "sketches": [], + "summary": "accepted exact" + } + ], + "cost": { + "cost_per_second": 1.04956195066e-10, + "cpu_core_seconds_per_second": 9.33433333333e-6, + "per_node": { + "0": { + "cost_per_second": 1.08692000534e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 9.66666666667e-7, + "detail": "scan 10000 samples; x 0.0167/s; holds 48 bytes for 0.058 ms; keeps 480000 bytes of raw data on disk", + "multiplier": 1, + "operator": "Scan", + "timing": "query_time" + }, + "1": { + "cost_per_second": 2.06140001012e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.83333333333e-6, + "detail": "time range 15s: keep 10000 of 10000 rows; x 0.0167/s; holds 48 bytes for 0.110 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "2": { + "cost_per_second": 1.87400920147e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-6, + "detail": "sort 10000 rows in 10 partitions; x 0.0167/s; holds 48000 bytes for 0.100 ms", + "multiplier": 1, + "operator": "Sort", + "timing": "query_time" + }, + "3": { + "cost_per_second": 9.37000004601e-15, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 8.33333333333e-10, + "detail": "limit to 50 rows; x 0.0167/s; holds 48 bytes for 0.000 ms", + "multiplier": 1, + "operator": "Limit", + "timing": "query_time" + }, + "4": { + "cost_per_second": 7.87080002576e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 7e-7, + "detail": "scan 10000 samples; x 0.0167/s; holds 32 bytes for 0.042 ms", + "multiplier": 1, + "operator": "Scan", + "timing": "query_time" + }, + "5": { + "cost_per_second": 2.06140000675e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.83333333333e-6, + "detail": "time range 15s: keep 10000 of 10000 rows; x 0.0167/s; holds 32 bytes for 0.110 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "6": { + "cost_per_second": 2.62368588036e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 2.33333333333e-6, + "detail": "sort 10000 rows in 1 partitions; x 0.0167/s; holds 320000 bytes for 0.140 ms", + "multiplier": 1, + "operator": "Sort", + "timing": "query_time" + }, + "7": { + "cost_per_second": 1.87400000613e-15, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-10, + "detail": "limit to 10 rows; x 0.0167/s; holds 32 bytes for 0.000 ms", + "multiplier": 1, + "operator": "Limit", + "timing": "query_time" + } + }, + "source": "analytical-cost-v2 (illustrative statistics)", + "usage": { + "average_memory_bytes": 0.826882178667, + "cpu_ops_per_second": 8001.0, + "disk_bytes": 480000, + "peak_cpu_cores": 2, + "peak_memory_bytes": 368240, + "scanned_bytes_per_second": 13333.3333333 + } + }, + "dag": { + "edges": [ + { + "consumer": 1, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 3, + 0 + ] + ] + }, + "producer": 0, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 2, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 3, + 0 + ] + ] + }, + "producer": 1, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 3, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 3, + 0 + ] + ] + }, + "producer": 2, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 5, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 4, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 6, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 5, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 7, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 6, + "role": "Input", + "window": "NotApplicable" + } + ], + "nodes": [ + { + "id": 0, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 3, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Scan": { + "predicates": [], + "schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 3, + 0 + ] + ] + }, + "source": { + "TimeSeries": { + "metric": "data" + } + } + } + } + }, + "retention_ms": 15000 + }, + { + "id": 1, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 3, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "TimeRange": { + "child": 0, + "kind": "instant", + "range": { + "nanos": 0, + "secs": 15 + } + } + } + } + }, + { + "id": 2, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 3, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Sort": { + "child": 1, + "keys": [ + { + "ascending": false, + "expr": { + "Column": 1 + }, + "nulls_first": false + } + ], + "partition_by": [ + 2 + ] + } + } + } + }, + { + "id": 3, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 3, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Limit": { + "child": 2, + "n": 5, + "offset": 0, + "partition_by": [ + 2 + ] + } + } + } + }, + { + "id": 4, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Scan": { + "predicates": [], + "schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "source": { + "TimeSeries": { + "metric": "data" + } + } + } + } + }, + "retention_ms": 15000 + }, + { + "id": 5, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "TimeRange": { + "child": 4, + "kind": "instant", + "range": { + "nanos": 0, + "secs": 15 + } + } + } + } + }, + { + "id": 6, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Sort": { + "child": 5, + "keys": [ + { + "ascending": false, + "expr": { + "Column": 1 + }, + "nulls_first": false + } + ], + "partition_by": [] + } + } + } + }, + { + "id": 7, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Limit": { + "child": 6, + "n": 10, + "offset": 0, + "partition_by": [] + } + } + } + } + ], + "roots": [ + 3, + 7 + ], + "scalar_roots": [] + } + } +} diff --git a/crates/devtools/tests/sketch_plan_snapshots/topk-rate-counter-raw-retained.json b/crates/devtools/tests/sketch_plan_snapshots/topk-rate-counter-raw-retained.json new file mode 100644 index 000000000..48a0f93f1 --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/topk-rate-counter-raw-retained.json @@ -0,0 +1,684 @@ +{ + "accuracy_guarantees": "enforced", + "materialized_views": [], + "queries": [ + "topk(5, rate(data[5m]))", + "topk(10, rate(data[5m]))" + ], + "selected": { + "accepted": [ + { + "accepted_metric": null, + "sketches": [], + "summary": "accepted exact" + }, + { + "accepted_metric": null, + "sketches": [], + "summary": "accepted exact" + } + ], + "cost": { + "cost_per_second": 1.29944529231e-8, + "cpu_core_seconds_per_second": 0.00115559015, + "per_node": { + "0": { + "cost_per_second": 1.57416000515e-10, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.000014, + "detail": "scan 200000 samples; x 0.0167/s; holds 32 bytes for 0.840 ms; keeps 6400000 bytes of raw data on disk", + "multiplier": 1, + "operator": "Scan", + "timing": "query_time" + }, + "1": { + "cost_per_second": 4.1228000135e-10, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.0000366666666667, + "detail": "time range 300s: keep 200000 of 200000 rows; x 0.0167/s; holds 32 bytes for 2.200 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "2": { + "cost_per_second": 7.60943621216e-9, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.000676666666667, + "detail": "build exact Rate accumulator into 10000 states: 200000 rows x 33 ops, 200000 group visits; x 0.0167/s; holds 1280000 bytes for 40.600 ms", + "multiplier": 1, + "operator": "SummaryAgg", + "timing": "query_time" + }, + "3": { + "cost_per_second": 4.685e-9, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.000416666666667, + "detail": "finalize 10000 accumulators; x 0.0167/s", + "multiplier": 1, + "operator": "FinalizeExactAccumulator", + "timing": "query_time" + }, + "4": { + "cost_per_second": 1.29807420476e-10, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.0000115445, + "detail": "hash aggregate 10000 rows into 1 groups: 69 ops per row, 1 group visits; x 0.0167/s; holds 80016 bytes for 0.693 ms", + "multiplier": 1, + "operator": "Aggregate", + "timing": "query_time" + }, + "5": { + "cost_per_second": 5.1328860126e-13, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 4.565e-8, + "detail": "hash aggregate 1 rows into 1 groups: 69 ops per row, 1 group visits; x 0.0167/s; holds 24 bytes for 0.003 ms", + "multiplier": 1, + "operator": "Aggregate", + "timing": "query_time" + } + }, + "source": "analytical-cost-v2 (illustrative statistics)", + "usage": { + "average_memory_bytes": 867.058700474, + "cpu_ops_per_second": 1144923.48333, + "disk_bytes": 6400000, + "peak_cpu_cores": 2, + "peak_memory_bytes": 1360104, + "scanned_bytes_per_second": 106666.666667 + } + }, + "dag": { + "edges": [ + { + "consumer": 1, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 0, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 2, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 1, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 3, + "data_state": { + "primitive": "SummaryState", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "ExactAggregate": [ + "Rate", + "Rate" + ] + }, + "name": "state", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 2, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 4, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 3, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 5, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "float64" + }, + "name": "topk_10", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": null, + "unique_keys": [ + [ + 1 + ] + ] + }, + "producer": 4, + "role": "Input", + "window": "NotApplicable" + } + ], + "nodes": [ + { + "id": 0, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Scan": { + "predicates": [], + "schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "source": { + "TimeSeries": { + "metric": "data" + } + } + } + } + }, + "retention_ms": 300000 + }, + { + "id": 1, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "TimeRange": { + "child": 0, + "kind": "range", + "range": { + "nanos": 0, + "secs": 300 + } + } + } + } + }, + { + "id": 2, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "ExactAggregate": [ + "Rate", + "Rate" + ] + }, + "name": "state", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "SummaryState", + "timing": "query_time" + }, + "payload": { + "ASAP": { + "SummaryAgg": { + "child": 1, + "filter": null, + "input": { + "item": null, + "weight": { + "Column": "SampleValue" + } + }, + "reduction": "PerEntity", + "summary_type": { + "ExactAggregate": [ + "Rate", + "Rate" + ] + } + } + } + } + }, + { + "id": 3, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "ASAP": { + "FinalizeExactAccumulator": { + "child": 2 + } + } + } + }, + { + "id": 4, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "float64" + }, + "name": "topk_10", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": null, + "unique_keys": [ + [ + 1 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Aggregate": { + "child": 3, + "filters": [], + "having": null, + "measures": [ + { + "k": 10, + "kind": "top_k" + } + ], + "output_names": [ + "" + ], + "reduction": { + "Reduce": [] + } + } + } + } + }, + { + "id": 5, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "float64" + }, + "name": "topk_5", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": null, + "unique_keys": [ + [ + 1 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Aggregate": { + "child": 4, + "filters": [], + "having": null, + "measures": [ + { + "k": 5, + "kind": "top_k" + } + ], + "output_names": [ + "" + ], + "reduction": { + "Reduce": [] + } + } + } + } + } + ], + "roots": [ + 5, + 4 + ], + "scalar_roots": [] + } + } +} diff --git a/crates/devtools/tests/sketch_plan_snapshots/topk-sum-count-over-time-accuracy-raw-retained.json b/crates/devtools/tests/sketch_plan_snapshots/topk-sum-count-over-time-accuracy-raw-retained.json new file mode 100644 index 000000000..f7d6fc32b --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/topk-sum-count-over-time-accuracy-raw-retained.json @@ -0,0 +1,699 @@ +{ + "accuracy_guarantees": "enforced", + "materialized_views": [], + "queries": [ + "topk(5, sum_over_time(data[5m]))", + "topk(5, count_over_time(data[5m]))" + ], + "selected": { + "accepted": [ + { + "accepted_metric": null, + "sketches": [], + "summary": "accepted exact" + }, + { + "accepted_metric": null, + "sketches": [], + "summary": "accepted exact" + } + ], + "cost": { + "cost_per_second": 2.44429469052e-8, + "cpu_core_seconds_per_second": 0.00217375566667, + "per_node": { + "0": { + "cost_per_second": 1.57416000515e-10, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.000014, + "detail": "scan 200000 samples; x 0.0167/s; holds 32 bytes for 0.840 ms; keeps 6400000 bytes of raw data on disk", + "multiplier": 1, + "operator": "Scan", + "timing": "query_time" + }, + "1": { + "cost_per_second": 4.125499097e-10, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.0000366666666667, + "detail": "time range 300s: keep 200000 of 200000 rows; x 0.0167/s; holds 6400000 bytes for 2.200 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "2": { + "cost_per_second": 1.1806683077e-8, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.00105, + "detail": "hash aggregate 200000 rows into 10000 groups: 20 ops per row, 200000 group visits; x 0.0167/s; holds 400000 bytes for 63.000 ms", + "multiplier": 1, + "operator": "Aggregate", + "timing": "query_time" + }, + "3": { + "cost_per_second": 1.29807420476e-10, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.0000115445, + "detail": "hash aggregate 10000 rows into 1 groups: 69 ops per row, 1 group visits; x 0.0167/s; holds 80016 bytes for 0.693 ms", + "multiplier": 1, + "operator": "Aggregate", + "timing": "query_time" + }, + "4": { + "cost_per_second": 1.1806683077e-8, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.00105, + "detail": "hash aggregate 200000 rows into 10000 groups: 20 ops per row, 200000 group visits; x 0.0167/s; holds 400000 bytes for 63.000 ms", + "multiplier": 1, + "operator": "Aggregate", + "timing": "query_time" + }, + "5": { + "cost_per_second": 1.29807420476e-10, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.0000115445, + "detail": "hash aggregate 10000 rows into 1 groups: 69 ops per row, 1 group visits; x 0.0167/s; holds 80016 bytes for 0.693 ms", + "multiplier": 1, + "operator": "Aggregate", + "timing": "query_time" + } + }, + "source": "analytical-cost-v2 (illustrative statistics)", + "usage": { + "average_memory_bytes": 1076.51460409, + "cpu_ops_per_second": 2163089.0, + "disk_bytes": 6400000, + "peak_cpu_cores": 2, + "peak_memory_bytes": 7360064, + "scanned_bytes_per_second": 106666.666667 + } + }, + "dag": { + "edges": [ + { + "consumer": 1, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 0, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 2, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 1, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 3, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 2, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 4, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 1, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 5, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 4, + "role": "Input", + "window": "NotApplicable" + } + ], + "nodes": [ + { + "id": 0, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Scan": { + "predicates": [], + "schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "source": { + "TimeSeries": { + "metric": "data" + } + } + } + } + }, + "retention_ms": 300000 + }, + { + "id": 1, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "TimeRange": { + "child": 0, + "kind": "range", + "range": { + "nanos": 0, + "secs": 300 + } + } + } + } + }, + { + "id": 2, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Aggregate": { + "child": 1, + "filters": [], + "having": null, + "measures": [ + { + "kind": "count" + } + ], + "output_names": [ + "" + ], + "reduction": "PerEntity" + } + } + } + }, + { + "id": 3, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "float64" + }, + "name": "topk_5", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": null, + "unique_keys": [ + [ + 1 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Aggregate": { + "child": 2, + "filters": [], + "having": null, + "measures": [ + { + "k": 5, + "kind": "top_k" + } + ], + "output_names": [ + "" + ], + "reduction": { + "Reduce": [] + } + } + } + } + }, + { + "id": 4, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Aggregate": { + "child": 1, + "filters": [], + "having": null, + "measures": [ + { + "col": null, + "kind": "sum" + } + ], + "output_names": [ + "" + ], + "reduction": "PerEntity" + } + } + } + }, + { + "id": 5, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "float64" + }, + "name": "topk_5", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": null, + "unique_keys": [ + [ + 1 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Aggregate": { + "child": 4, + "filters": [], + "having": null, + "measures": [ + { + "k": 5, + "kind": "top_k" + } + ], + "output_names": [ + "" + ], + "reduction": { + "Reduce": [] + } + } + } + } + } + ], + "roots": [ + 5, + 3 + ], + "scalar_roots": [] + } + } +} diff --git a/crates/devtools/tests/sketch_plan_snapshots/topk-sum-count-over-time-raw-retained.json b/crates/devtools/tests/sketch_plan_snapshots/topk-sum-count-over-time-raw-retained.json new file mode 100644 index 000000000..f7d6fc32b --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/topk-sum-count-over-time-raw-retained.json @@ -0,0 +1,699 @@ +{ + "accuracy_guarantees": "enforced", + "materialized_views": [], + "queries": [ + "topk(5, sum_over_time(data[5m]))", + "topk(5, count_over_time(data[5m]))" + ], + "selected": { + "accepted": [ + { + "accepted_metric": null, + "sketches": [], + "summary": "accepted exact" + }, + { + "accepted_metric": null, + "sketches": [], + "summary": "accepted exact" + } + ], + "cost": { + "cost_per_second": 2.44429469052e-8, + "cpu_core_seconds_per_second": 0.00217375566667, + "per_node": { + "0": { + "cost_per_second": 1.57416000515e-10, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.000014, + "detail": "scan 200000 samples; x 0.0167/s; holds 32 bytes for 0.840 ms; keeps 6400000 bytes of raw data on disk", + "multiplier": 1, + "operator": "Scan", + "timing": "query_time" + }, + "1": { + "cost_per_second": 4.125499097e-10, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.0000366666666667, + "detail": "time range 300s: keep 200000 of 200000 rows; x 0.0167/s; holds 6400000 bytes for 2.200 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "2": { + "cost_per_second": 1.1806683077e-8, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.00105, + "detail": "hash aggregate 200000 rows into 10000 groups: 20 ops per row, 200000 group visits; x 0.0167/s; holds 400000 bytes for 63.000 ms", + "multiplier": 1, + "operator": "Aggregate", + "timing": "query_time" + }, + "3": { + "cost_per_second": 1.29807420476e-10, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.0000115445, + "detail": "hash aggregate 10000 rows into 1 groups: 69 ops per row, 1 group visits; x 0.0167/s; holds 80016 bytes for 0.693 ms", + "multiplier": 1, + "operator": "Aggregate", + "timing": "query_time" + }, + "4": { + "cost_per_second": 1.1806683077e-8, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.00105, + "detail": "hash aggregate 200000 rows into 10000 groups: 20 ops per row, 200000 group visits; x 0.0167/s; holds 400000 bytes for 63.000 ms", + "multiplier": 1, + "operator": "Aggregate", + "timing": "query_time" + }, + "5": { + "cost_per_second": 1.29807420476e-10, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.0000115445, + "detail": "hash aggregate 10000 rows into 1 groups: 69 ops per row, 1 group visits; x 0.0167/s; holds 80016 bytes for 0.693 ms", + "multiplier": 1, + "operator": "Aggregate", + "timing": "query_time" + } + }, + "source": "analytical-cost-v2 (illustrative statistics)", + "usage": { + "average_memory_bytes": 1076.51460409, + "cpu_ops_per_second": 2163089.0, + "disk_bytes": 6400000, + "peak_cpu_cores": 2, + "peak_memory_bytes": 7360064, + "scanned_bytes_per_second": 106666.666667 + } + }, + "dag": { + "edges": [ + { + "consumer": 1, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 0, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 2, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 1, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 3, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 2, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 4, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 1, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 5, + "data_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 4, + "role": "Input", + "window": "NotApplicable" + } + ], + "nodes": [ + { + "id": 0, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Scan": { + "predicates": [], + "schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "source": { + "TimeSeries": { + "metric": "data" + } + } + } + } + }, + "retention_ms": 300000 + }, + { + "id": 1, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "TimeRange": { + "child": 0, + "kind": "range", + "range": { + "nanos": 0, + "secs": 300 + } + } + } + } + }, + { + "id": 2, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Aggregate": { + "child": 1, + "filters": [], + "having": null, + "measures": [ + { + "kind": "count" + } + ], + "output_names": [ + "" + ], + "reduction": "PerEntity" + } + } + } + }, + { + "id": 3, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "float64" + }, + "name": "topk_5", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": null, + "unique_keys": [ + [ + 1 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Aggregate": { + "child": 2, + "filters": [], + "having": null, + "measures": [ + { + "k": 5, + "kind": "top_k" + } + ], + "output_names": [ + "" + ], + "reduction": { + "Reduce": [] + } + } + } + } + }, + { + "id": 4, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "value", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Aggregate": { + "child": 1, + "filters": [], + "having": null, + "measures": [ + { + "col": null, + "kind": "sum" + } + ], + "output_names": [ + "" + ], + "reduction": "PerEntity" + } + } + } + }, + { + "id": 5, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "float64" + }, + "name": "topk_5", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": null, + "unique_keys": [ + [ + 1 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Aggregate": { + "child": 4, + "filters": [], + "having": null, + "measures": [ + { + "k": 5, + "kind": "top_k" + } + ], + "output_names": [ + "" + ], + "reduction": { + "Reduce": [] + } + } + } + } + } + ], + "roots": [ + 5, + 3 + ], + "scalar_roots": [] + } + } +} diff --git a/crates/devtools/tests/sketch_plan_snapshots/workloads/avg-nested-labels.json b/crates/devtools/tests/sketch_plan_snapshots/workloads/avg-nested-labels.json new file mode 100644 index 000000000..c0ca05ab6 --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/workloads/avg-nested-labels.json @@ -0,0 +1,70 @@ +{ + "query_workload": { + "language": "promql", + "repeating_queries": [ + { + "query": "avg by (job) (data)", + "demand": { + "fixed_interval_at": { + "interval": 60000, + "evaluation_phase": 0 + } + }, + "predictability": { + "predictable": { + "known_at": null + } + }, + "requirements": {} + }, + { + "query": "avg by (job, host) (data)", + "demand": { + "fixed_interval_at": { + "interval": 60000, + "evaluation_phase": 0 + } + }, + "predictability": { + "predictable": { + "known_at": null + } + }, + "requirements": {} + }, + { + "query": "avg (data)", + "demand": { + "fixed_interval_at": { + "interval": 60000, + "evaluation_phase": 0 + } + }, + "predictability": { + "predictable": { + "known_at": null + } + }, + "requirements": {} + } + ] + }, + "data_workload": { + "arrival": { + "ingesting": { + "rows_per_second": 666.6666666666666 + } + }, + "sources": { + "data": { + "series_count": 10000, + "metric_type": "gauge", + "sample_interval": 15000, + "distinct_values_per_label": { + "job": 10, + "host": 1000 + } + } + } + } +} \ No newline at end of file diff --git a/crates/devtools/tests/sketch_plan_snapshots/workloads/chains-10m-5m-3m-10s.json b/crates/devtools/tests/sketch_plan_snapshots/workloads/chains-10m-5m-3m-10s.json new file mode 100644 index 000000000..0ea4738b8 --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/workloads/chains-10m-5m-3m-10s.json @@ -0,0 +1,82 @@ +{ + "query_workload": { + "language": "promql", + "query_batch": null, + "repeating_queries": [ + { + "query": "quantile_over_time(0.5, data[10m])", + "demand": { + "fixed_interval_at": { + "interval": 300000, + "evaluation_phase": 0 + } + }, + "requirements": { + "accuracy": { + "max_error": 0.01, + "failure_probability": 0.001 + } + }, + "predictability": { + "predictable": { + "known_at": null + } + } + }, + { + "query": "quantile_over_time(0.9, data[5m])", + "demand": { + "fixed_interval_at": { + "interval": 300000, + "evaluation_phase": 0 + } + }, + "requirements": { + "accuracy": { + "max_error": 0.01, + "failure_probability": 0.001 + } + }, + "predictability": { + "predictable": { + "known_at": null + } + } + }, + { + "query": "quantile_over_time(0.99, data[3m])", + "demand": { + "fixed_interval_at": { + "interval": 10000, + "evaluation_phase": 0 + } + }, + "requirements": { + "accuracy": { + "max_error": 0.01, + "failure_probability": 0.001 + } + }, + "predictability": { + "predictable": { + "known_at": null + } + } + } + ] + }, + "data_workload": { + "arrival": { + "ingesting": { + "rows_per_second": 666.6666666666666 + } + }, + "sources": { + "data": { + "series_count": 10000, + "metric_type": "gauge", + "sample_interval": 15000 + } + } + } +} \ No newline at end of file diff --git a/crates/devtools/tests/sketch_plan_snapshots/workloads/chains-10m-5m-3m-3m.json b/crates/devtools/tests/sketch_plan_snapshots/workloads/chains-10m-5m-3m-3m.json new file mode 100644 index 000000000..c96ea7f17 --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/workloads/chains-10m-5m-3m-3m.json @@ -0,0 +1,82 @@ +{ + "query_workload": { + "language": "promql", + "query_batch": null, + "repeating_queries": [ + { + "query": "quantile_over_time(0.5, data[10m])", + "demand": { + "fixed_interval_at": { + "interval": 300000, + "evaluation_phase": 0 + } + }, + "requirements": { + "accuracy": { + "max_error": 0.01, + "failure_probability": 0.001 + } + }, + "predictability": { + "predictable": { + "known_at": null + } + } + }, + { + "query": "quantile_over_time(0.9, data[5m])", + "demand": { + "fixed_interval_at": { + "interval": 300000, + "evaluation_phase": 0 + } + }, + "requirements": { + "accuracy": { + "max_error": 0.01, + "failure_probability": 0.001 + } + }, + "predictability": { + "predictable": { + "known_at": null + } + } + }, + { + "query": "quantile_over_time(0.99, data[3m])", + "demand": { + "fixed_interval_at": { + "interval": 180000, + "evaluation_phase": 0 + } + }, + "requirements": { + "accuracy": { + "max_error": 0.01, + "failure_probability": 0.001 + } + }, + "predictability": { + "predictable": { + "known_at": null + } + } + } + ] + }, + "data_workload": { + "arrival": { + "ingesting": { + "rows_per_second": 666.6666666666666 + } + }, + "sources": { + "data": { + "series_count": 10000, + "metric_type": "gauge", + "sample_interval": 15000 + } + } + } +} \ No newline at end of file diff --git a/crates/devtools/tests/sketch_plan_snapshots/workloads/distinct-over-time-1pct.json b/crates/devtools/tests/sketch_plan_snapshots/workloads/distinct-over-time-1pct.json new file mode 100644 index 000000000..2696e7f80 --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/workloads/distinct-over-time-1pct.json @@ -0,0 +1,65 @@ +{ + "query_workload": { + "language": "promql", + "repeating_queries": [ + { + "query": "distinct_over_time(data[10m])", + "demand": { + "fixed_interval_at": { + "interval": 300000, + "evaluation_phase": 0 + } + }, + "predictability": { + "predictable": { + "known_at": null + } + }, + "requirements": { + "accuracy": { + "max_error": 0.01, + "failure_probability": 0.001 + } + } + }, + { + "query": "distinct_over_time(data[5m])", + "demand": { + "fixed_interval_at": { + "interval": 300000, + "evaluation_phase": 0 + } + }, + "predictability": { + "predictable": { + "known_at": null + } + }, + "requirements": { + "accuracy": { + "max_error": 0.01, + "failure_probability": 0.001 + } + } + } + ] + }, + "data_workload": { + "arrival": { + "ingesting": { + "rows_per_second": 666.6666666666666 + } + }, + "sources": { + "data": { + "series_count": 10000, + "metric_type": "gauge", + "sample_interval": 15000, + "distinct_values_per_label": { + "job": 10, + "host": 1000 + } + } + } + } +} \ No newline at end of file diff --git a/crates/devtools/tests/sketch_plan_snapshots/workloads/distinct-over-time-5pct.json b/crates/devtools/tests/sketch_plan_snapshots/workloads/distinct-over-time-5pct.json new file mode 100644 index 000000000..61c4a72b6 --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/workloads/distinct-over-time-5pct.json @@ -0,0 +1,65 @@ +{ + "query_workload": { + "language": "promql", + "repeating_queries": [ + { + "query": "distinct_over_time(data[10m])", + "demand": { + "fixed_interval_at": { + "interval": 300000, + "evaluation_phase": 0 + } + }, + "predictability": { + "predictable": { + "known_at": null + } + }, + "requirements": { + "accuracy": { + "max_error": 0.05, + "failure_probability": 0.001 + } + } + }, + { + "query": "distinct_over_time(data[5m])", + "demand": { + "fixed_interval_at": { + "interval": 300000, + "evaluation_phase": 0 + } + }, + "predictability": { + "predictable": { + "known_at": null + } + }, + "requirements": { + "accuracy": { + "max_error": 0.05, + "failure_probability": 0.001 + } + } + } + ] + }, + "data_workload": { + "arrival": { + "ingesting": { + "rows_per_second": 666.6666666666666 + } + }, + "sources": { + "data": { + "series_count": 10000, + "metric_type": "gauge", + "sample_interval": 15000, + "distinct_values_per_label": { + "job": 10, + "host": 1000 + } + } + } + } +} \ No newline at end of file diff --git a/crates/devtools/tests/sketch_plan_snapshots/workloads/distinct-two-forms.json b/crates/devtools/tests/sketch_plan_snapshots/workloads/distinct-two-forms.json new file mode 100644 index 000000000..aad3e77db --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/workloads/distinct-two-forms.json @@ -0,0 +1,66 @@ +{ + "query_workload": { + "language": "promql", + "repeating_queries": [ + { + "query": "distinct_over_time(data[5m])", + "demand": { + "fixed_interval_at": { + "interval": 60000, + "evaluation_phase": 0 + } + }, + "predictability": { + "predictable": { + "known_at": null + } + }, + "requirements": { + "accuracy": { + "max_error": 0.05, + "failure_probability": 0.001 + } + } + }, + { + "query": "count(count_values(\"v\", data))", + "demand": { + "fixed_interval_at": { + "interval": 60000, + "evaluation_phase": 0 + } + }, + "predictability": { + "predictable": { + "known_at": null + } + }, + "requirements": { + "accuracy": { + "max_error": 0.05, + "failure_probability": 0.001 + } + } + } + ] + }, + "data_workload": { + "arrival": { + "ingesting": { + "rows_per_second": 666.6666666666666 + } + }, + "sources": { + "data": { + "series_count": 10000, + "metric_type": "gauge", + "sample_interval": 15000, + "distinct_values_per_label": { + "job": 10, + "host": 1000 + }, + "max_distinct_per_evaluation": 1000000 + } + } + } +} \ No newline at end of file diff --git a/crates/devtools/tests/sketch_plan_snapshots/workloads/entropy-and-distinct.json b/crates/devtools/tests/sketch_plan_snapshots/workloads/entropy-and-distinct.json new file mode 100644 index 000000000..80c7e8363 --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/workloads/entropy-and-distinct.json @@ -0,0 +1,65 @@ +{ + "query_workload": { + "language": "promql", + "repeating_queries": [ + { + "query": "entropy_over_time(data[5m])", + "demand": { + "fixed_interval_at": { + "interval": 60000, + "evaluation_phase": 0 + } + }, + "predictability": { + "predictable": { + "known_at": null + } + }, + "requirements": { + "accuracy": { + "max_error": 0.05, + "failure_probability": 0.001 + } + } + }, + { + "query": "distinct_over_time(data[5m])", + "demand": { + "fixed_interval_at": { + "interval": 60000, + "evaluation_phase": 0 + } + }, + "predictability": { + "predictable": { + "known_at": null + } + }, + "requirements": { + "accuracy": { + "max_error": 0.05, + "failure_probability": 0.001 + } + } + } + ] + }, + "data_workload": { + "arrival": { + "ingesting": { + "rows_per_second": 666.6666666666666 + } + }, + "sources": { + "data": { + "series_count": 10000, + "metric_type": "gauge", + "sample_interval": 15000, + "distinct_values_per_label": { + "job": 10, + "host": 1000 + } + } + } + } +} \ No newline at end of file diff --git a/crates/devtools/tests/sketch_plan_snapshots/workloads/entropy-over-time.json b/crates/devtools/tests/sketch_plan_snapshots/workloads/entropy-over-time.json new file mode 100644 index 000000000..96adaf36d --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/workloads/entropy-over-time.json @@ -0,0 +1,45 @@ +{ + "query_workload": { + "language": "promql", + "repeating_queries": [ + { + "query": "entropy_over_time(data[5m])", + "demand": { + "fixed_interval_at": { + "interval": 60000, + "evaluation_phase": 0 + } + }, + "predictability": { + "predictable": { + "known_at": null + } + }, + "requirements": { + "accuracy": { + "max_error": 0.01, + "failure_probability": 0.001 + } + } + } + ] + }, + "data_workload": { + "arrival": { + "ingesting": { + "rows_per_second": 666.6666666666666 + } + }, + "sources": { + "data": { + "series_count": 10000, + "metric_type": "gauge", + "sample_interval": 15000, + "distinct_values_per_label": { + "job": 10, + "host": 1000 + } + } + } + } +} \ No newline at end of file diff --git a/crates/devtools/tests/sketch_plan_snapshots/workloads/mixed-quantiles.json b/crates/devtools/tests/sketch_plan_snapshots/workloads/mixed-quantiles.json new file mode 100644 index 000000000..a25a2a190 --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/workloads/mixed-quantiles.json @@ -0,0 +1,107 @@ +{ + "query_workload": { + "language": "promql", + "query_batch": null, + "repeating_queries": [ + { + "query": "quantile_over_time(0.5, data[5m])", + "demand": { + "fixed_interval_at": {"interval": 60000, "evaluation_phase": 0} + }, + "requirements": { + "accuracy": { + "max_error": 0.01, + "failure_probability": 0.001 + } + }, + "predictability": { + "predictable": { + "known_at": null + } + } + }, + { + "query": "quantile_over_time(0.9, data[5m])", + "demand": { + "fixed_interval_at": {"interval": 60000, "evaluation_phase": 0} + }, + "requirements": { + "accuracy": { + "max_error": 0.01, + "failure_probability": 0.001 + } + }, + "predictability": { + "predictable": { + "known_at": null + } + } + }, + { + "query": "quantile by (job) (0.9, data)", + "demand": { + "fixed_interval_at": {"interval": 60000, "evaluation_phase": 0} + }, + "requirements": { + "accuracy": { + "max_error": 0.01, + "failure_probability": 0.001 + } + }, + "predictability": { + "predictable": { + "known_at": null + } + } + }, + { + "query": "quantile by (job, host) (0.5, data)", + "demand": { + "fixed_interval_at": {"interval": 15000, "evaluation_phase": 0} + }, + "requirements": { + "accuracy": { + "max_error": 0.01, + "failure_probability": 0.001 + } + }, + "predictability": { + "predictable": { + "known_at": null + } + } + }, + { + "query": "quantile_over_time(0.75, data[10m])", + "demand": { + "fixed_interval_at": {"interval": 120000, "evaluation_phase": 0} + }, + "requirements": { + "accuracy": { + "max_error": 0.01, + "failure_probability": 0.001 + } + }, + "predictability": { + "predictable": { + "known_at": null + } + } + } + ] + }, + "data_workload": { + "arrival": { + "ingesting": { + "rows_per_second": 666.6666666666666 + } + }, + "sources": { + "data": { + "series_count": 10000, + "metric_type": "gauge", + "sample_interval": 15000 + } + } + } +} \ No newline at end of file diff --git a/crates/devtools/tests/sketch_plan_snapshots/workloads/quantile-7m-every-5m.json b/crates/devtools/tests/sketch_plan_snapshots/workloads/quantile-7m-every-5m.json new file mode 100644 index 000000000..9ab3b563f --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/workloads/quantile-7m-every-5m.json @@ -0,0 +1,45 @@ +{ + "query_workload": { + "language": "promql", + "repeating_queries": [ + { + "query": "quantile_over_time(0.9, data[7m])", + "demand": { + "fixed_interval_at": { + "interval": 300000, + "evaluation_phase": 0 + } + }, + "predictability": { + "predictable": { + "known_at": null + } + }, + "requirements": { + "accuracy": { + "max_error": 0.01, + "failure_probability": 0.001 + } + } + } + ] + }, + "data_workload": { + "arrival": { + "ingesting": { + "rows_per_second": 666.6666666666666 + } + }, + "sources": { + "data": { + "series_count": 10000, + "metric_type": "gauge", + "sample_interval": 15000, + "distinct_values_per_label": { + "job": 10, + "host": 1000 + } + } + } + } +} \ No newline at end of file diff --git a/crates/devtools/tests/sketch_plan_snapshots/workloads/quantile-exact.json b/crates/devtools/tests/sketch_plan_snapshots/workloads/quantile-exact.json new file mode 100644 index 000000000..76c878e26 --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/workloads/quantile-exact.json @@ -0,0 +1,40 @@ +{ + "query_workload": { + "language": "promql", + "repeating_queries": [ + { + "query": "quantile_over_time(0.9, data[5m])", + "demand": { + "fixed_interval_at": { + "interval": 60000, + "evaluation_phase": 0 + } + }, + "predictability": { + "predictable": { + "known_at": null + } + }, + "requirements": {} + } + ] + }, + "data_workload": { + "arrival": { + "ingesting": { + "rows_per_second": 666.6666666666666 + } + }, + "sources": { + "data": { + "series_count": 10000, + "metric_type": "gauge", + "sample_interval": 15000, + "distinct_values_per_label": { + "job": 10, + "host": 1000 + } + } + } + } +} \ No newline at end of file diff --git a/crates/devtools/tests/sketch_plan_snapshots/workloads/quantile-over-time-phase-0.json b/crates/devtools/tests/sketch_plan_snapshots/workloads/quantile-over-time-phase-0.json new file mode 100644 index 000000000..65af77b36 --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/workloads/quantile-over-time-phase-0.json @@ -0,0 +1,56 @@ +{ + "query_workload": { + "language": "promql", + "query_batch": null, + "repeating_queries": [ + { + "query": "quantile_over_time(0.5, data[5m])", + "demand": { + "fixed_interval_at": {"interval": 60000, "evaluation_phase": 0} + }, + "requirements": { + "accuracy": { + "max_error": 0.01, + "failure_probability": 0.001 + } + }, + "predictability": { + "predictable": { + "known_at": null + } + } + }, + { + "query": "quantile_over_time(0.9, data[5m])", + "demand": { + "fixed_interval_at": {"interval": 60000, "evaluation_phase": 0} + }, + "requirements": { + "accuracy": { + "max_error": 0.01, + "failure_probability": 0.001 + } + }, + "predictability": { + "predictable": { + "known_at": null + } + } + } + ] + }, + "data_workload": { + "arrival": { + "ingesting": { + "rows_per_second": 666.6666666666666 + } + }, + "sources": { + "data": { + "series_count": 10000, + "metric_type": "gauge", + "sample_interval": 15000 + } + } + } +} \ No newline at end of file diff --git a/crates/devtools/tests/sketch_plan_snapshots/workloads/quantile-phase-0-and-30s.json b/crates/devtools/tests/sketch_plan_snapshots/workloads/quantile-phase-0-and-30s.json new file mode 100644 index 000000000..064c3d916 --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/workloads/quantile-phase-0-and-30s.json @@ -0,0 +1,65 @@ +{ + "query_workload": { + "language": "promql", + "repeating_queries": [ + { + "query": "quantile_over_time(0.9, data[5m])", + "demand": { + "fixed_interval_at": { + "interval": 60000, + "evaluation_phase": 0 + } + }, + "predictability": { + "predictable": { + "known_at": null + } + }, + "requirements": { + "accuracy": { + "max_error": 0.01, + "failure_probability": 0.001 + } + } + }, + { + "query": "quantile_over_time(0.5, data[5m])", + "demand": { + "fixed_interval_at": { + "interval": 60000, + "evaluation_phase": 30000 + } + }, + "predictability": { + "predictable": { + "known_at": null + } + }, + "requirements": { + "accuracy": { + "max_error": 0.01, + "failure_probability": 0.001 + } + } + } + ] + }, + "data_workload": { + "arrival": { + "ingesting": { + "rows_per_second": 666.6666666666666 + } + }, + "sources": { + "data": { + "series_count": 10000, + "metric_type": "gauge", + "sample_interval": 15000, + "distinct_values_per_label": { + "job": 10, + "host": 1000 + } + } + } + } +} \ No newline at end of file diff --git a/crates/devtools/tests/sketch_plan_snapshots/workloads/quantile-two-targets.json b/crates/devtools/tests/sketch_plan_snapshots/workloads/quantile-two-targets.json new file mode 100644 index 000000000..12ac0afbf --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/workloads/quantile-two-targets.json @@ -0,0 +1,65 @@ +{ + "query_workload": { + "language": "promql", + "repeating_queries": [ + { + "query": "quantile_over_time(0.9, data[5m])", + "demand": { + "fixed_interval_at": { + "interval": 60000, + "evaluation_phase": 0 + } + }, + "predictability": { + "predictable": { + "known_at": null + } + }, + "requirements": { + "accuracy": { + "max_error": 0.01, + "failure_probability": 0.001 + } + } + }, + { + "query": "quantile_over_time(0.9, data[5m])", + "demand": { + "fixed_interval_at": { + "interval": 60000, + "evaluation_phase": 0 + } + }, + "predictability": { + "predictable": { + "known_at": null + } + }, + "requirements": { + "accuracy": { + "max_error": 0.05, + "failure_probability": 0.001 + } + } + } + ] + }, + "data_workload": { + "arrival": { + "ingesting": { + "rows_per_second": 666.6666666666666 + } + }, + "sources": { + "data": { + "series_count": 10000, + "metric_type": "gauge", + "sample_interval": 15000, + "distinct_values_per_label": { + "job": 10, + "host": 1000 + } + } + } + } +} \ No newline at end of file diff --git a/crates/devtools/tests/sketch_plan_snapshots/workloads/rollup-quantile-disjoint-labels.json b/crates/devtools/tests/sketch_plan_snapshots/workloads/rollup-quantile-disjoint-labels.json new file mode 100644 index 000000000..22babb48f --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/workloads/rollup-quantile-disjoint-labels.json @@ -0,0 +1,65 @@ +{ + "query_workload": { + "language": "promql", + "repeating_queries": [ + { + "query": "quantile by (job) (0.9, data)", + "demand": { + "fixed_interval_at": { + "interval": 60000, + "evaluation_phase": 0 + } + }, + "requirements": { + "accuracy": { + "max_error": 0.01, + "failure_probability": 0.001 + } + }, + "predictability": { + "predictable": { + "known_at": null + } + } + }, + { + "query": "quantile by (host) (0.9, data)", + "demand": { + "fixed_interval_at": { + "interval": 60000, + "evaluation_phase": 0 + } + }, + "requirements": { + "accuracy": { + "max_error": 0.01, + "failure_probability": 0.001 + } + }, + "predictability": { + "predictable": { + "known_at": null + } + } + } + ] + }, + "data_workload": { + "arrival": { + "ingesting": { + "rows_per_second": 666.6666666666666 + } + }, + "sources": { + "data": { + "series_count": 10000, + "metric_type": "gauge", + "sample_interval": 15000, + "distinct_values_per_label": { + "job": 10, + "host": 1000 + } + } + } + } +} \ No newline at end of file diff --git a/crates/devtools/tests/sketch_plan_snapshots/workloads/rollup-quantile-nested-labels.json b/crates/devtools/tests/sketch_plan_snapshots/workloads/rollup-quantile-nested-labels.json new file mode 100644 index 000000000..2425f7e79 --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/workloads/rollup-quantile-nested-labels.json @@ -0,0 +1,65 @@ +{ + "query_workload": { + "language": "promql", + "repeating_queries": [ + { + "query": "quantile by (job) (0.9, data)", + "demand": { + "fixed_interval_at": { + "interval": 60000, + "evaluation_phase": 0 + } + }, + "requirements": { + "accuracy": { + "max_error": 0.01, + "failure_probability": 0.001 + } + }, + "predictability": { + "predictable": { + "known_at": null + } + } + }, + { + "query": "quantile by (job, host) (0.9, data)", + "demand": { + "fixed_interval_at": { + "interval": 60000, + "evaluation_phase": 0 + } + }, + "requirements": { + "accuracy": { + "max_error": 0.01, + "failure_probability": 0.001 + } + }, + "predictability": { + "predictable": { + "known_at": null + } + } + } + ] + }, + "data_workload": { + "arrival": { + "ingesting": { + "rows_per_second": 666.6666666666666 + } + }, + "sources": { + "data": { + "series_count": 10000, + "metric_type": "gauge", + "sample_interval": 15000, + "distinct_values_per_label": { + "job": 10, + "host": 1000 + } + } + } + } +} \ No newline at end of file diff --git a/crates/devtools/tests/sketch_plan_snapshots/workloads/rollup-sum-chain.json b/crates/devtools/tests/sketch_plan_snapshots/workloads/rollup-sum-chain.json new file mode 100644 index 000000000..a21249781 --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/workloads/rollup-sum-chain.json @@ -0,0 +1,70 @@ +{ + "query_workload": { + "language": "promql", + "repeating_queries": [ + { + "query": "sum by (job) (data)", + "demand": { + "fixed_interval_at": { + "interval": 60000, + "evaluation_phase": 0 + } + }, + "predictability": { + "predictable": { + "known_at": null + } + }, + "requirements": {} + }, + { + "query": "sum by (job, host) (data)", + "demand": { + "fixed_interval_at": { + "interval": 60000, + "evaluation_phase": 0 + } + }, + "predictability": { + "predictable": { + "known_at": null + } + }, + "requirements": {} + }, + { + "query": "sum (data)", + "demand": { + "fixed_interval_at": { + "interval": 60000, + "evaluation_phase": 0 + } + }, + "predictability": { + "predictable": { + "known_at": null + } + }, + "requirements": {} + } + ] + }, + "data_workload": { + "arrival": { + "ingesting": { + "rows_per_second": 666.6666666666666 + } + }, + "sources": { + "data": { + "series_count": 10000, + "metric_type": "gauge", + "sample_interval": 15000, + "distinct_values_per_label": { + "job": 10, + "host": 1000 + } + } + } + } +} \ No newline at end of file diff --git a/crates/devtools/tests/sketch_plan_snapshots/workloads/sign-non-negative.json b/crates/devtools/tests/sketch_plan_snapshots/workloads/sign-non-negative.json new file mode 100644 index 000000000..0c402ebf4 --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/workloads/sign-non-negative.json @@ -0,0 +1,68 @@ +{ + "query_workload": { + "language": "promql", + "repeating_queries": [ + { + "query": "quantile_over_time(0.9, data[5m])", + "demand": { + "fixed_interval_at": { + "interval": 60000, + "evaluation_phase": 0 + } + }, + "predictability": { + "predictable": { + "known_at": null + } + }, + "requirements": { + "accuracy": { + "max_error": 0.05, + "failure_probability": 0.001 + } + } + }, + { + "query": "topk(5, sum_over_time(data[5m]))", + "demand": { + "fixed_interval_at": { + "interval": 60000, + "evaluation_phase": 0 + } + }, + "predictability": { + "predictable": { + "known_at": null + } + }, + "requirements": { + "accuracy": { + "max_error": 0.05, + "failure_probability": 0.001 + } + } + } + ] + }, + "data_workload": { + "arrival": { + "ingesting": { + "rows_per_second": 666.6666666666666 + } + }, + "sources": { + "data": { + "series_count": 10000, + "metric_type": "gauge", + "sample_interval": 15000, + "distinct_values_per_label": { + "job": 10, + "host": 1000 + }, + "column_signs": { + "value": "non_negative" + } + } + } + } +} \ No newline at end of file diff --git a/crates/devtools/tests/sketch_plan_snapshots/workloads/sign-unknown.json b/crates/devtools/tests/sketch_plan_snapshots/workloads/sign-unknown.json new file mode 100644 index 000000000..b204fadb6 --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/workloads/sign-unknown.json @@ -0,0 +1,65 @@ +{ + "query_workload": { + "language": "promql", + "repeating_queries": [ + { + "query": "quantile_over_time(0.9, data[5m])", + "demand": { + "fixed_interval_at": { + "interval": 60000, + "evaluation_phase": 0 + } + }, + "predictability": { + "predictable": { + "known_at": null + } + }, + "requirements": { + "accuracy": { + "max_error": 0.05, + "failure_probability": 0.001 + } + } + }, + { + "query": "topk(5, sum_over_time(data[5m]))", + "demand": { + "fixed_interval_at": { + "interval": 60000, + "evaluation_phase": 0 + } + }, + "predictability": { + "predictable": { + "known_at": null + } + }, + "requirements": { + "accuracy": { + "max_error": 0.05, + "failure_probability": 0.001 + } + } + } + ] + }, + "data_workload": { + "arrival": { + "ingesting": { + "rows_per_second": 666.6666666666666 + } + }, + "sources": { + "data": { + "series_count": 10000, + "metric_type": "gauge", + "sample_interval": 15000, + "distinct_values_per_label": { + "job": 10, + "host": 1000 + } + } + } + } +} \ No newline at end of file diff --git a/crates/devtools/tests/sketch_plan_snapshots/workloads/sql-rollup-quantile-different-windows.json b/crates/devtools/tests/sketch_plan_snapshots/workloads/sql-rollup-quantile-different-windows.json new file mode 100644 index 000000000..70d013b37 --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/workloads/sql-rollup-quantile-different-windows.json @@ -0,0 +1,67 @@ +{ + "query_workload": { + "language": { + "sql": "datafusion_sql" + }, + "repeating_queries": [ + { + "query": "SELECT job, approx_percentile_cont(value, 0.9) AS value FROM data WHERE ts >= now() - INTERVAL '5 minutes' GROUP BY job", + "demand": { + "fixed_interval_at": { + "interval": 60000, + "evaluation_phase": 0 + } + }, + "requirements": { + "accuracy": { + "max_error": 0.01, + "failure_probability": 0.001 + } + }, + "predictability": { + "predictable": { + "known_at": null + } + } + }, + { + "query": "SELECT job, host, approx_percentile_cont(value, 0.9) AS value FROM data WHERE ts >= now() - INTERVAL '10 minutes' GROUP BY job, host", + "demand": { + "fixed_interval_at": { + "interval": 60000, + "evaluation_phase": 0 + } + }, + "requirements": { + "accuracy": { + "max_error": 0.01, + "failure_probability": 0.001 + } + }, + "predictability": { + "predictable": { + "known_at": null + } + } + } + ] + }, + "data_workload": { + "arrival": { + "ingesting": { + "rows_per_second": 666.6666666666666 + } + }, + "sources": { + "data": { + "series_count": 10000, + "metric_type": "gauge", + "sample_interval": 15000, + "distinct_values_per_label": { + "job": 10, + "host": 1000 + } + } + } + } +} \ No newline at end of file diff --git a/crates/devtools/tests/sketch_plan_snapshots/workloads/sql-rollup-quantile-same-window.json b/crates/devtools/tests/sketch_plan_snapshots/workloads/sql-rollup-quantile-same-window.json new file mode 100644 index 000000000..bb3dc25ce --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/workloads/sql-rollup-quantile-same-window.json @@ -0,0 +1,67 @@ +{ + "query_workload": { + "language": { + "sql": "datafusion_sql" + }, + "repeating_queries": [ + { + "query": "SELECT job, approx_percentile_cont(value, 0.9) AS value FROM data WHERE ts >= now() - INTERVAL '5 minutes' GROUP BY job", + "demand": { + "fixed_interval_at": { + "interval": 60000, + "evaluation_phase": 0 + } + }, + "requirements": { + "accuracy": { + "max_error": 0.01, + "failure_probability": 0.001 + } + }, + "predictability": { + "predictable": { + "known_at": null + } + } + }, + { + "query": "SELECT job, host, approx_percentile_cont(value, 0.9) AS value FROM data WHERE ts >= now() - INTERVAL '5 minutes' GROUP BY job, host", + "demand": { + "fixed_interval_at": { + "interval": 60000, + "evaluation_phase": 0 + } + }, + "requirements": { + "accuracy": { + "max_error": 0.01, + "failure_probability": 0.001 + } + }, + "predictability": { + "predictable": { + "known_at": null + } + } + } + ] + }, + "data_workload": { + "arrival": { + "ingesting": { + "rows_per_second": 666.6666666666666 + } + }, + "sources": { + "data": { + "series_count": 10000, + "metric_type": "gauge", + "sample_interval": 15000, + "distinct_values_per_label": { + "job": 10, + "host": 1000 + } + } + } + } +} \ No newline at end of file diff --git a/crates/devtools/tests/sketch_plan_snapshots/workloads/sql-table-data.tables.json b/crates/devtools/tests/sketch_plan_snapshots/workloads/sql-table-data.tables.json new file mode 100644 index 000000000..30b9b2250 --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/workloads/sql-table-data.tables.json @@ -0,0 +1,24 @@ +[ + { + "name": "data", + "columns": [ + { + "name": "ts", + "type": "timestamp" + }, + { + "name": "job", + "type": "utf8" + }, + { + "name": "host", + "type": "utf8" + }, + { + "name": "value", + "type": "float64" + } + ], + "time_index": 0 + } +] diff --git a/crates/devtools/tests/sketch_plan_snapshots/workloads/stddev-nested-labels.json b/crates/devtools/tests/sketch_plan_snapshots/workloads/stddev-nested-labels.json new file mode 100644 index 000000000..7e1ed8f3e --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/workloads/stddev-nested-labels.json @@ -0,0 +1,55 @@ +{ + "query_workload": { + "language": "promql", + "repeating_queries": [ + { + "query": "stddev by (job) (data)", + "demand": { + "fixed_interval_at": { + "interval": 60000, + "evaluation_phase": 0 + } + }, + "predictability": { + "predictable": { + "known_at": null + } + }, + "requirements": {} + }, + { + "query": "stddev by (job, host) (data)", + "demand": { + "fixed_interval_at": { + "interval": 60000, + "evaluation_phase": 0 + } + }, + "predictability": { + "predictable": { + "known_at": null + } + }, + "requirements": {} + } + ] + }, + "data_workload": { + "arrival": { + "ingesting": { + "rows_per_second": 666.6666666666666 + } + }, + "sources": { + "data": { + "series_count": 10000, + "metric_type": "gauge", + "sample_interval": 15000, + "distinct_values_per_label": { + "job": 10, + "host": 1000 + } + } + } + } +} \ No newline at end of file diff --git a/crates/devtools/tests/sketch_plan_snapshots/workloads/sum-5m-avg-10m-over-time.json b/crates/devtools/tests/sketch_plan_snapshots/workloads/sum-5m-avg-10m-over-time.json new file mode 100644 index 000000000..c3f90c6e2 --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/workloads/sum-5m-avg-10m-over-time.json @@ -0,0 +1,55 @@ +{ + "query_workload": { + "language": "promql", + "repeating_queries": [ + { + "query": "sum_over_time(data[5m])", + "demand": { + "fixed_interval_at": { + "interval": 60000, + "evaluation_phase": 0 + } + }, + "predictability": { + "predictable": { + "known_at": null + } + }, + "requirements": {} + }, + { + "query": "avg_over_time(data[10m])", + "demand": { + "fixed_interval_at": { + "interval": 60000, + "evaluation_phase": 0 + } + }, + "predictability": { + "predictable": { + "known_at": null + } + }, + "requirements": {} + } + ] + }, + "data_workload": { + "arrival": { + "ingesting": { + "rows_per_second": 666.6666666666666 + } + }, + "sources": { + "data": { + "series_count": 10000, + "metric_type": "gauge", + "sample_interval": 15000, + "distinct_values_per_label": { + "job": 10, + "host": 1000 + } + } + } + } +} \ No newline at end of file diff --git a/crates/devtools/tests/sketch_plan_snapshots/workloads/sum-avg-over-time-5m.json b/crates/devtools/tests/sketch_plan_snapshots/workloads/sum-avg-over-time-5m.json new file mode 100644 index 000000000..dff641c90 --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/workloads/sum-avg-over-time-5m.json @@ -0,0 +1,55 @@ +{ + "query_workload": { + "language": "promql", + "repeating_queries": [ + { + "query": "sum_over_time(data[5m])", + "demand": { + "fixed_interval_at": { + "interval": 60000, + "evaluation_phase": 0 + } + }, + "predictability": { + "predictable": { + "known_at": null + } + }, + "requirements": {} + }, + { + "query": "avg_over_time(data[5m])", + "demand": { + "fixed_interval_at": { + "interval": 60000, + "evaluation_phase": 0 + } + }, + "predictability": { + "predictable": { + "known_at": null + } + }, + "requirements": {} + } + ] + }, + "data_workload": { + "arrival": { + "ingesting": { + "rows_per_second": 666.6666666666666 + } + }, + "sources": { + "data": { + "series_count": 10000, + "metric_type": "gauge", + "sample_interval": 15000, + "distinct_values_per_label": { + "job": 10, + "host": 1000 + } + } + } + } +} \ No newline at end of file diff --git a/crates/devtools/tests/sketch_plan_snapshots/workloads/sum-over-time-two-intervals.json b/crates/devtools/tests/sketch_plan_snapshots/workloads/sum-over-time-two-intervals.json new file mode 100644 index 000000000..a652025f4 --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/workloads/sum-over-time-two-intervals.json @@ -0,0 +1,55 @@ +{ + "query_workload": { + "language": "promql", + "repeating_queries": [ + { + "query": "sum_over_time(data[10m])", + "demand": { + "fixed_interval_at": { + "interval": 300000, + "evaluation_phase": 0 + } + }, + "predictability": { + "predictable": { + "known_at": null + } + }, + "requirements": {} + }, + { + "query": "sum_over_time(data[5m])", + "demand": { + "fixed_interval_at": { + "interval": 60000, + "evaluation_phase": 0 + } + }, + "predictability": { + "predictable": { + "known_at": null + } + }, + "requirements": {} + } + ] + }, + "data_workload": { + "arrival": { + "ingesting": { + "rows_per_second": 666.6666666666666 + } + }, + "sources": { + "data": { + "series_count": 10000, + "metric_type": "gauge", + "sample_interval": 15000, + "distinct_values_per_label": { + "job": 10, + "host": 1000 + } + } + } + } +} \ No newline at end of file diff --git a/crates/devtools/tests/sketch_plan_snapshots/workloads/topk-5-and-10-accuracy.json b/crates/devtools/tests/sketch_plan_snapshots/workloads/topk-5-and-10-accuracy.json new file mode 100644 index 000000000..6878f1005 --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/workloads/topk-5-and-10-accuracy.json @@ -0,0 +1,65 @@ +{ + "query_workload": { + "language": "promql", + "repeating_queries": [ + { + "query": "topk(5, data)", + "demand": { + "fixed_interval_at": { + "interval": 60000, + "evaluation_phase": 0 + } + }, + "predictability": { + "predictable": { + "known_at": null + } + }, + "requirements": { + "accuracy": { + "max_error": 0.01, + "failure_probability": 0.001 + } + } + }, + { + "query": "topk(10, data)", + "demand": { + "fixed_interval_at": { + "interval": 60000, + "evaluation_phase": 0 + } + }, + "predictability": { + "predictable": { + "known_at": null + } + }, + "requirements": { + "accuracy": { + "max_error": 0.01, + "failure_probability": 0.001 + } + } + } + ] + }, + "data_workload": { + "arrival": { + "ingesting": { + "rows_per_second": 666.6666666666666 + } + }, + "sources": { + "data": { + "series_count": 10000, + "metric_type": "gauge", + "sample_interval": 15000, + "distinct_values_per_label": { + "job": 10, + "host": 1000 + } + } + } + } +} \ No newline at end of file diff --git a/crates/devtools/tests/sketch_plan_snapshots/workloads/topk-5-and-10.json b/crates/devtools/tests/sketch_plan_snapshots/workloads/topk-5-and-10.json new file mode 100644 index 000000000..d0f5a95c0 --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/workloads/topk-5-and-10.json @@ -0,0 +1,55 @@ +{ + "query_workload": { + "language": "promql", + "repeating_queries": [ + { + "query": "topk(5, data)", + "demand": { + "fixed_interval_at": { + "interval": 60000, + "evaluation_phase": 0 + } + }, + "predictability": { + "predictable": { + "known_at": null + } + }, + "requirements": {} + }, + { + "query": "topk(10, data)", + "demand": { + "fixed_interval_at": { + "interval": 60000, + "evaluation_phase": 0 + } + }, + "predictability": { + "predictable": { + "known_at": null + } + }, + "requirements": {} + } + ] + }, + "data_workload": { + "arrival": { + "ingesting": { + "rows_per_second": 666.6666666666666 + } + }, + "sources": { + "data": { + "series_count": 10000, + "metric_type": "gauge", + "sample_interval": 15000, + "distinct_values_per_label": { + "job": 10, + "host": 1000 + } + } + } + } +} \ No newline at end of file diff --git a/crates/devtools/tests/sketch_plan_snapshots/workloads/topk-by-job-and-global.json b/crates/devtools/tests/sketch_plan_snapshots/workloads/topk-by-job-and-global.json new file mode 100644 index 000000000..9f51439ab --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/workloads/topk-by-job-and-global.json @@ -0,0 +1,55 @@ +{ + "query_workload": { + "language": "promql", + "repeating_queries": [ + { + "query": "topk by (job) (5, data)", + "demand": { + "fixed_interval_at": { + "interval": 60000, + "evaluation_phase": 0 + } + }, + "predictability": { + "predictable": { + "known_at": null + } + }, + "requirements": {} + }, + { + "query": "topk(10, data)", + "demand": { + "fixed_interval_at": { + "interval": 60000, + "evaluation_phase": 0 + } + }, + "predictability": { + "predictable": { + "known_at": null + } + }, + "requirements": {} + } + ] + }, + "data_workload": { + "arrival": { + "ingesting": { + "rows_per_second": 666.6666666666666 + } + }, + "sources": { + "data": { + "series_count": 10000, + "metric_type": "gauge", + "sample_interval": 15000, + "distinct_values_per_label": { + "job": 10, + "host": 1000 + } + } + } + } +} \ No newline at end of file diff --git a/crates/devtools/tests/sketch_plan_snapshots/workloads/topk-rate-counter.json b/crates/devtools/tests/sketch_plan_snapshots/workloads/topk-rate-counter.json new file mode 100644 index 000000000..9359b40fc --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/workloads/topk-rate-counter.json @@ -0,0 +1,55 @@ +{ + "query_workload": { + "language": "promql", + "repeating_queries": [ + { + "query": "topk(5, rate(data[5m]))", + "demand": { + "fixed_interval_at": { + "interval": 60000, + "evaluation_phase": 0 + } + }, + "predictability": { + "predictable": { + "known_at": null + } + }, + "requirements": {} + }, + { + "query": "topk(10, rate(data[5m]))", + "demand": { + "fixed_interval_at": { + "interval": 60000, + "evaluation_phase": 0 + } + }, + "predictability": { + "predictable": { + "known_at": null + } + }, + "requirements": {} + } + ] + }, + "data_workload": { + "arrival": { + "ingesting": { + "rows_per_second": 666.6666666666666 + } + }, + "sources": { + "data": { + "series_count": 10000, + "metric_type": "counter", + "sample_interval": 15000, + "distinct_values_per_label": { + "job": 10, + "host": 1000 + } + } + } + } +} \ No newline at end of file diff --git a/crates/devtools/tests/sketch_plan_snapshots/workloads/topk-sum-count-over-time-accuracy.json b/crates/devtools/tests/sketch_plan_snapshots/workloads/topk-sum-count-over-time-accuracy.json new file mode 100644 index 000000000..84ccc1f62 --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/workloads/topk-sum-count-over-time-accuracy.json @@ -0,0 +1,65 @@ +{ + "query_workload": { + "language": "promql", + "repeating_queries": [ + { + "query": "topk(5, sum_over_time(data[5m]))", + "demand": { + "fixed_interval_at": { + "interval": 60000, + "evaluation_phase": 0 + } + }, + "predictability": { + "predictable": { + "known_at": null + } + }, + "requirements": { + "accuracy": { + "max_error": 0.01, + "failure_probability": 0.001 + } + } + }, + { + "query": "topk(5, count_over_time(data[5m]))", + "demand": { + "fixed_interval_at": { + "interval": 60000, + "evaluation_phase": 0 + } + }, + "predictability": { + "predictable": { + "known_at": null + } + }, + "requirements": { + "accuracy": { + "max_error": 0.01, + "failure_probability": 0.001 + } + } + } + ] + }, + "data_workload": { + "arrival": { + "ingesting": { + "rows_per_second": 666.6666666666666 + } + }, + "sources": { + "data": { + "series_count": 10000, + "metric_type": "gauge", + "sample_interval": 15000, + "distinct_values_per_label": { + "job": 10, + "host": 1000 + } + } + } + } +} \ No newline at end of file diff --git a/crates/devtools/tests/sketch_plan_snapshots/workloads/topk-sum-count-over-time.json b/crates/devtools/tests/sketch_plan_snapshots/workloads/topk-sum-count-over-time.json new file mode 100644 index 000000000..47a82779f --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/workloads/topk-sum-count-over-time.json @@ -0,0 +1,55 @@ +{ + "query_workload": { + "language": "promql", + "repeating_queries": [ + { + "query": "topk(5, sum_over_time(data[5m]))", + "demand": { + "fixed_interval_at": { + "interval": 60000, + "evaluation_phase": 0 + } + }, + "predictability": { + "predictable": { + "known_at": null + } + }, + "requirements": {} + }, + { + "query": "topk(5, count_over_time(data[5m]))", + "demand": { + "fixed_interval_at": { + "interval": 60000, + "evaluation_phase": 0 + } + }, + "predictability": { + "predictable": { + "known_at": null + } + }, + "requirements": {} + } + ] + }, + "data_workload": { + "arrival": { + "ingesting": { + "rows_per_second": 666.6666666666666 + } + }, + "sources": { + "data": { + "series_count": 10000, + "metric_type": "gauge", + "sample_interval": 15000, + "distinct_values_per_label": { + "job": 10, + "host": 1000 + } + } + } + } +} \ No newline at end of file From e317e2051a3954ade5b857853f0cb331cee70eb2 Mon Sep 17 00:00:00 2001 From: Milind Srivastava Date: Wed, 18 Nov 2026 14:35:55 -0500 Subject: [PATCH 2/2] test(devtools): regenerate distinct-two-forms after #1417 The KMV build's operations per row print to three decimals (116.19991733920547 -> 116.2). No plan changed. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_014qhwq4GZoWwtfFWWr9CKkr --- .../sketch_plan_snapshots/distinct-two-forms-raw-retained.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/devtools/tests/sketch_plan_snapshots/distinct-two-forms-raw-retained.json b/crates/devtools/tests/sketch_plan_snapshots/distinct-two-forms-raw-retained.json index 4e1a1e550..83c288f1c 100644 --- a/crates/devtools/tests/sketch_plan_snapshots/distinct-two-forms-raw-retained.json +++ b/crates/devtools/tests/sketch_plan_snapshots/distinct-two-forms-raw-retained.json @@ -73,7 +73,7 @@ "cost_per_second": 1.08178905869e-8, "cost_source": "analytical", "cpu_core_seconds_per_second": 0.000953999724464, - "detail": "build Kmv into 10000 states: 200000 rows x 116.19991733920547 ops, 200000 group visits; x 0.0167/s; holds 83040000 bytes for 57.240 ms", + "detail": "build Kmv into 10000 states: 200000 rows x 116.2 ops, 200000 group visits; x 0.0167/s; holds 83040000 bytes for 57.240 ms", "multiplier": 1, "operator": "SummaryAgg", "timing": "query_time"