From e8c2135f66090a5e01c9f192100b422991bfd376 Mon Sep 17 00:00:00 2001 From: Milind Srivastava Date: Wed, 11 Nov 2026 21:55:35 -0500 Subject: [PATCH] test(devtools): sketch plan snapshots for 33 small single-purpose workloads (#1278) Each workload pins one memo behavior through its selected plan: 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. The snapshots record current behavior, including the known gaps (#1260, #1270, #1281, #1282) named in each `covers`, so their fixes show up as snapshot diffs. 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 | 1102 +++++++++ .../chains-10m-5m-3m-10s-mvp.json | 1920 +++++++++++++++ .../chains-10m-5m-3m-10s-raw-retained.json | 1733 +++++++++++++ .../chains-10m-5m-3m-3m-raw-retained.json | 1733 +++++++++++++ .../distinct-over-time-1pct-raw-retained.json | 589 +++++ .../distinct-over-time-5pct-raw-retained.json | 1165 +++++++++ .../distinct-two-forms-raw-retained.json | 899 +++++++ .../entropy-and-distinct-raw-retained.json | 715 ++++++ .../entropy-over-time-raw-retained.json | 361 +++ .../tests/sketch_plan_snapshots/manifest.json | 200 ++ .../mixed-quantiles-raw-retained.json | 2152 +++++++++++++++++ .../quantile-7m-every-5m-raw-retained.json | 594 +++++ .../quantile-exact-raw-retained.json | 362 +++ ...ntile-over-time-no-phase-raw-retained.json | 834 +++++++ ...antile-over-time-phase-0-raw-retained.json | 834 +++++++ ...quantile-phase-0-and-30s-raw-retained.json | 1156 +++++++++ .../quantile-two-targets-raw-retained.json | 607 +++++ ...quantile-disjoint-labels-raw-retained.json | 1144 +++++++++ ...p-quantile-nested-labels-raw-retained.json | 990 ++++++++ .../rollup-sum-chain-raw-retained.json | 1306 ++++++++++ .../sign-non-negative-raw-retained.json | 940 +++++++ .../sign-unknown-raw-retained.json | 934 +++++++ ...antile-different-windows-raw-retained.json | 1271 ++++++++++ ...lup-quantile-same-window-raw-retained.json | 1144 +++++++++ .../stddev-nested-labels-raw-retained.json | 793 ++++++ ...sum-5m-avg-10m-over-time-raw-retained.json | 701 ++++++ .../sum-avg-over-time-5m-raw-retained.json | 967 ++++++++ ...-over-time-two-intervals-raw-retained.json | 904 +++++++ .../topk-5-and-10-accuracy-raw-retained.json | 578 +++++ .../topk-5-and-10-raw-retained.json | 578 +++++ .../topk-by-job-and-global-raw-retained.json | 950 ++++++++ .../topk-rate-counter-raw-retained.json | 685 ++++++ ...count-over-time-accuracy-raw-retained.json | 921 +++++++ ...topk-sum-count-over-time-raw-retained.json | 921 +++++++ .../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 + .../quantile-over-time-no-phase.json | 56 + .../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 + 68 files changed, 34724 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-no-phase-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-no-phase.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 5d67f43f3..6cd8690f4 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 pin one memo behavior through +//! its plan: 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. Some are exact; they pin sharing between +//! queries, which the single-query corpus does not. +//! //! `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..bffeeb070 --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/avg-nested-labels-raw-retained.json @@ -0,0 +1,1102 @@ +{ + "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": 4.94739224068e-11, + "cpu_core_seconds_per_second": 4.4e-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", + "multiplier": 1, + "operator": "Scan", + "timing": "query_time" + }, + "1": { + "cost_per_second": 1.8740000092e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-7, + "detail": "time range 15s: keep 10000 of 10000 rows; x 0.0167/s; holds 48 bytes for 0.010 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "2": { + "cost_per_second": 3.74800015336e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 3.33333333333e-7, + "detail": "hash aggregate 10000 rows into 10 groups; x 0.0167/s; holds 400 bytes for 0.020 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": 1.87400001227e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-7, + "detail": "time range 15s: keep 10000 of 10000 rows; x 0.0167/s; holds 64 bytes for 0.010 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "5": { + "cost_per_second": 5.62232205135e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 5e-7, + "detail": "hash aggregate 10000 rows into 10000 groups; x 0.0167/s; holds 560000 bytes for 0.030 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": 1.87400000613e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-7, + "detail": "time range 15s: keep 10000 of 10000 rows; x 0.0167/s; holds 32 bytes for 0.010 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "8": { + "cost_per_second": 1.8740000046e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-7, + "detail": "hash aggregate 10000 rows into 1 groups; x 0.0167/s; holds 24 bytes for 0.010 ms", + "multiplier": 1, + "operator": "Aggregate", + "timing": "query_time" + } + }, + "source": "analytical-cost-v2 (illustrative statistics)", + "usage": { + "average_memory_bytes": 0.280309066667, + "cpu_ops_per_second": 2000.0, + "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": [ + { + "guarantee": null, + "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 + }, + { + "guarantee": null, + "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 + } + } + } + } + }, + { + "guarantee": null, + "id": 2, + "lifetime": "None", + "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 + ] + } + } + } + } + }, + { + "guarantee": null, + "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 + }, + { + "guarantee": null, + "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 + } + } + } + } + }, + { + "guarantee": null, + "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 + ] + } + } + } + } + }, + { + "guarantee": null, + "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 + }, + { + "guarantee": null, + "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 + } + } + } + } + }, + { + "guarantee": null, + "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..72f696a39 --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/chains-10m-5m-3m-10s-mvp.json @@ -0,0 +1,1920 @@ +{ + "accuracy_guarantees": "enforced", + "materialized_views": [ + { + "coverage": { + "definition_id": "db2249c6dbec728b74ef27d5fd17e449", + "selection": [ + { + "columns": [] + } + ] + }, + "inputs": { + "materialized_views": [], + "raw_data_windows": [ + { + "end_offset_ms": 0, + "source": { + "TimeSeries": { + "metric": "data" + } + }, + "width_ms": 10000 + } + ] + }, + "node_id": 1, + "refresh": "at_ingestion", + "retention_ms": 180000 + }, + { + "coverage": { + "definition_id": "db2249c6dbec728b74ef27d5fd17e449", + "selection": [ + { + "columns": [] + } + ] + }, + "inputs": { + "materialized_views": [], + "raw_data_windows": [ + { + "end_offset_ms": 0, + "source": { + "TimeSeries": { + "metric": "data" + } + }, + "width_ms": 300000 + } + ] + }, + "node_id": 7, + "refresh": "at_ingestion", + "retention_ms": 600000 + } + ], + "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": 2.25592082306e-7, + "cpu_core_seconds_per_second": 0.0000466041333333, + "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": 1.90577381836e-7, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.334e-6, + "detail": "build Kll in tumbling windows of 10000 ms for 10000 groups: 667 rows x (1 + depth 1); x 1.0000/s; keeps 165680000 bytes", + "multiplier": 1, + "operator": "SummaryTumblingWindowChain", + "timing": "ingestion_time" + }, + "10": { + "cost_per_second": 3.748e-13, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 3.33333333333e-8, + "detail": "estimate 10000 groups x 1; x 0.0033/s", + "multiplier": 1, + "operator": "SummaryEstimate", + "timing": "query_time" + }, + "11": { + "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" + }, + "12": { + "cost_per_second": 7.49600076679e-13, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 6.66666666667e-8, + "detail": "time range 600s: 2 tumbling windows of states; x 0.0033/s; holds 1000 bytes for 0.020 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "13": { + "cost_per_second": 7.5036678892e-13, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 6.66666666667e-8, + "detail": "merge 20000 states into 10000; x 0.0033/s; holds 10000000 bytes for 0.020 ms", + "multiplier": 1, + "operator": "SummaryMerge", + "timing": "query_time" + }, + "14": { + "cost_per_second": 3.748e-13, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 3.33333333333e-8, + "detail": "estimate 10000 groups x 1; x 0.0033/s", + "multiplier": 1, + "operator": "SummaryEstimate", + "timing": "query_time" + }, + "15": { + "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" + }, + "2": { + "cost_per_second": 2.02392018053e-10, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.000018, + "detail": "time range 180s: 18 tumbling windows of states; x 0.1000/s; holds 872 bytes for 0.180 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "3": { + "cost_per_second": 2.02572532783e-10, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.000018, + "detail": "merge 180000 states into 10000; x 0.1000/s; holds 8720000 bytes for 0.180 ms", + "multiplier": 1, + "operator": "SummaryMerge", + "timing": "query_time" + }, + "4": { + "cost_per_second": 1.1244e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1e-6, + "detail": "estimate 10000 groups x 1; x 0.1000/s", + "multiplier": 1, + "operator": "SummaryEstimate", + "timing": "query_time" + }, + "5": { + "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" + }, + "6": { + "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" + }, + "7": { + "cost_per_second": 3.45205008855e-8, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.334e-6, + "detail": "build Kll in tumbling windows of 300000 ms for 10000 groups: 667 rows x (1 + depth 1); x 1.0000/s; keeps 30000000 bytes", + "multiplier": 1, + "operator": "SummaryTumblingWindowChain", + "timing": "ingestion_time" + }, + "8": { + "cost_per_second": 3.74800038339e-13, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 3.33333333333e-8, + "detail": "time range 300s: 1 tumbling windows of states; x 0.0033/s; holds 1000 bytes for 0.010 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "9": { + "cost_per_second": 3.7518339446e-13, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 3.33333333333e-8, + "detail": "merge 10000 states into 10000; x 0.0033/s; holds 10000000 bytes for 0.010 ms", + "multiplier": 1, + "operator": "SummaryMerge", + "timing": "query_time" + } + }, + "source": "analytical-cost-v2 (illustrative statistics)", + "usage": { + "average_memory_bytes": 195680157.976, + "cpu_ops_per_second": 42335.3333333, + "disk_bytes": 0, + "peak_cpu_cores": 4, + "peak_memory_bytes": 224403032, + "scanned_bytes_per_second": 42688.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": 7, + "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": 6, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 8, + "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": 7, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 9, + "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": 8, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 10, + "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": 9, + "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": "quantile", + "nullable": false + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "producer": 10, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 12, + "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": 7, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 13, + "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": 12, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 14, + "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": 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": "quantile", + "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": [ + { + "guarantee": null, + "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" + } + } + } + } + } + }, + { + "guarantee": null, + "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": 2863 + } + }, + "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, + "summary_coverage": { + "definition_id": "db2249c6dbec728b74ef27d5fd17e449", + "selection": [ + { + "columns": [] + } + ] + } + }, + { + "guarantee": null, + "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": 2863 + } + }, + "payload": { + "NonASAP": { + "TimeRange": { + "child": 1, + "kind": "range", + "range": { + "nanos": 0, + "secs": 180 + } + } + } + } + }, + { + "guarantee": null, + "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": 2863 + } + }, + "payload": { + "ASAP": { + "SummaryMerge": { + "children": [ + 2 + ] + } + } + } + }, + { + "guarantee": null, + "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.99 + } + }, + "summary_input": 3 + } + } + } + }, + { + "guarantee": null, + "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 + } + } + ] + } + } + } + }, + { + "guarantee": null, + "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": "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" + } + } + } + } + } + }, + { + "guarantee": null, + "id": 7, + "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": 2863 + } + }, + "payload": { + "ASAP": { + "SummaryTumblingWindowChain": { + "child": 6, + "filter": null, + "input": { + "item": null, + "weight": { + "Column": "SampleValue" + } + }, + "reduction": "PerEntity", + "summary_type": { + "Sketch": "Kll" + }, + "tumbling_window_width_ms": 300000 + } + } + }, + "retention_ms": 600000, + "summary_coverage": { + "definition_id": "db2249c6dbec728b74ef27d5fd17e449", + "selection": [ + { + "columns": [] + } + ] + } + }, + { + "guarantee": null, + "id": 8, + "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": 2863 + } + }, + "payload": { + "NonASAP": { + "TimeRange": { + "child": 7, + "kind": "range", + "range": { + "nanos": 0, + "secs": 300 + } + } + } + } + }, + { + "guarantee": null, + "id": 9, + "lifetime": "None", + "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": { + "SummaryMerge": { + "children": [ + 8 + ] + } + } + } + }, + { + "guarantee": null, + "id": 10, + "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": 9 + } + } + } + }, + { + "guarantee": null, + "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": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "Project": { + "child": 10, + "cols": [ + { + "alias": "ts", + "expr": { + "Column": 0 + } + }, + { + "alias": "value", + "expr": { + "Column": 1 + } + }, + { + "alias": "$promql_series_identity", + "expr": { + "Column": 2 + } + } + ] + } + } + } + }, + { + "guarantee": null, + "id": 12, + "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": 2863 + } + }, + "payload": { + "NonASAP": { + "TimeRange": { + "child": 7, + "kind": "range", + "range": { + "nanos": 0, + "secs": 600 + } + } + } + } + }, + { + "guarantee": null, + "id": 13, + "lifetime": "None", + "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": { + "SummaryMerge": { + "children": [ + 12 + ] + } + } + } + }, + { + "guarantee": null, + "id": 14, + "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": 13 + } + } + } + }, + { + "guarantee": null, + "id": 15, + "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": 14, + "cols": [ + { + "alias": "ts", + "expr": { + "Column": 0 + } + }, + { + "alias": "value", + "expr": { + "Column": 1 + } + }, + { + "alias": "$promql_series_identity", + "expr": { + "Column": 2 + } + } + ] + } + } + } + } + ], + "roots": [ + 15, + 11, + 5 + ], + "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..367217f47 --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/chains-10m-5m-3m-10s-raw-retained.json @@ -0,0 +1,1733 @@ +{ + "accuracy_guarantees": "enforced", + "materialized_views": [], + "materialized_views_error": "the executor cannot compile the plan's query run: invalid DAG: node 1: a tumbling-window chain is built in ingestion runs", + "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": 9.55900325981e-10, + "cpu_core_seconds_per_second": 0.000085, + "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": 3.00225234753e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 2.66666666667e-6, + "detail": "build Kll in tumbling windows of 300000 ms for 10000 groups: 400000 rows x (1 + depth 1); x 0.0033/s; holds 12560000 bytes for 0.800 ms", + "multiplier": 1, + "operator": "SummaryTumblingWindowChain", + "timing": "query_time" + }, + "10": { + "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" + }, + "11": { + "cost_per_second": 1.34928000442e-10, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.000012, + "detail": "time range 180s: keep 120000 of 120000 rows; x 0.1000/s; holds 32 bytes for 0.120 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "12": { + "cost_per_second": 1.35048355189e-10, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.000012, + "detail": "build Kll into 10000 states: 120000 rows x depth 1; x 0.1000/s; holds 8720000 bytes for 0.120 ms", + "multiplier": 1, + "operator": "SummaryAgg", + "timing": "query_time" + }, + "13": { + "cost_per_second": 1.1244e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1e-6, + "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": 3.74800048154e-13, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 3.33333333333e-8, + "detail": "time range 300s: 1 tumbling windows of states; x 0.0033/s; holds 1256 bytes for 0.010 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "3": { + "cost_per_second": 3.75281543442e-13, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 3.33333333333e-8, + "detail": "merge 10000 states into 10000; x 0.0033/s; holds 12560000 bytes for 0.010 ms", + "multiplier": 1, + "operator": "SummaryMerge", + "timing": "query_time" + }, + "4": { + "cost_per_second": 3.748e-13, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 3.33333333333e-8, + "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": 7.49600096309e-13, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 6.66666666667e-8, + "detail": "time range 600s: 2 tumbling windows of states; x 0.0033/s; holds 1256 bytes for 0.020 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "7": { + "cost_per_second": 7.50563086883e-13, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 6.66666666667e-8, + "detail": "merge 20000 states into 10000; x 0.0033/s; holds 12560000 bytes for 0.020 ms", + "multiplier": 1, + "operator": "SummaryMerge", + "timing": "query_time" + }, + "8": { + "cost_per_second": 3.748e-13, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 3.33333333333e-8, + "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": 139.391669067, + "cpu_ops_per_second": 42333.3333333, + "disk_bytes": 12800000, + "peak_cpu_cores": 3, + "peak_memory_bytes": 46402704, + "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": "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": 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": "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": 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": 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": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 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": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "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": [ + { + "guarantee": null, + "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 + }, + { + "guarantee": null, + "id": 1, + "lifetime": { + "OneEvaluation": "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": "query_time" + }, + "parameters": { + "Kll": { + "k": 2863 + } + }, + "payload": { + "ASAP": { + "SummaryTumblingWindowChain": { + "child": 0, + "filter": null, + "input": { + "item": null, + "weight": { + "Column": "SampleValue" + } + }, + "reduction": "PerEntity", + "summary_type": { + "Sketch": "Kll" + }, + "tumbling_window_width_ms": 300000 + } + } + } + }, + { + "guarantee": null, + "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": 2863 + } + }, + "payload": { + "NonASAP": { + "TimeRange": { + "child": 1, + "kind": "range", + "range": { + "nanos": 0, + "secs": 300 + } + } + } + } + }, + { + "guarantee": null, + "id": 3, + "lifetime": "None", + "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": { + "SummaryMerge": { + "children": [ + 2 + ] + } + } + } + }, + { + "guarantee": null, + "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 + } + } + } + }, + { + "guarantee": null, + "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 + } + } + ] + } + } + } + }, + { + "guarantee": null, + "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": 2863 + } + }, + "payload": { + "NonASAP": { + "TimeRange": { + "child": 1, + "kind": "range", + "range": { + "nanos": 0, + "secs": 600 + } + } + } + } + }, + { + "guarantee": null, + "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": 2863 + } + }, + "payload": { + "ASAP": { + "SummaryMerge": { + "children": [ + 6 + ] + } + } + } + }, + { + "guarantee": null, + "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 + } + } + } + }, + { + "guarantee": null, + "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 + } + } + ] + } + } + } + }, + { + "guarantee": null, + "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": "$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 + }, + { + "guarantee": null, + "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": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "TimeRange": { + "child": 10, + "kind": "range", + "range": { + "nanos": 0, + "secs": 180 + } + } + } + } + }, + { + "guarantee": null, + "id": 12, + "lifetime": "None", + "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": 11, + "filter": null, + "input": { + "item": null, + "weight": { + "Column": "SampleValue" + } + }, + "reduction": "PerEntity", + "summary_type": { + "Sketch": "Kll" + } + } + } + } + }, + { + "guarantee": null, + "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 + } + } + } + }, + { + "guarantee": null, + "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-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..c6b8d653e --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/chains-10m-5m-3m-3m-raw-retained.json @@ -0,0 +1,1733 @@ +{ + "accuracy_guarantees": "enforced", + "materialized_views": [], + "materialized_views_error": "the executor cannot compile the plan's query run: invalid DAG: node 1: a tumbling-window chain is built in ingestion runs", + "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": 1.44469588321e-10, + "cpu_core_seconds_per_second": 0.0000128444444444, + "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": 3.00225234753e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 2.66666666667e-6, + "detail": "build Kll in tumbling windows of 300000 ms for 10000 groups: 400000 rows x (1 + depth 1); x 0.0033/s; holds 12560000 bytes for 0.800 ms", + "multiplier": 1, + "operator": "SummaryTumblingWindowChain", + "timing": "query_time" + }, + "10": { + "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" + }, + "11": { + "cost_per_second": 7.49600002454e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 6.66666666667e-7, + "detail": "time range 180s: keep 120000 of 120000 rows; x 0.0056/s; holds 32 bytes for 0.120 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "12": { + "cost_per_second": 7.50268639938e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 6.66666666667e-7, + "detail": "build Kll into 10000 states: 120000 rows x depth 1; x 0.0056/s; holds 8720000 bytes for 0.120 ms", + "multiplier": 1, + "operator": "SummaryAgg", + "timing": "query_time" + }, + "13": { + "cost_per_second": 6.24666666667e-13, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 5.55555555556e-8, + "detail": "estimate 10000 groups x 1; x 0.0056/s", + "multiplier": 1, + "operator": "SummaryEstimate", + "timing": "query_time" + }, + "14": { + "cost_per_second": 6.24666668711e-13, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 5.55555555556e-8, + "detail": "operator: pass 10000 rows; x 0.0056/s; holds 32 bytes for 0.010 ms", + "multiplier": 1, + "operator": "Project", + "timing": "query_time" + }, + "2": { + "cost_per_second": 3.74800048154e-13, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 3.33333333333e-8, + "detail": "time range 300s: 1 tumbling windows of states; x 0.0033/s; holds 1256 bytes for 0.010 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "3": { + "cost_per_second": 3.75281543442e-13, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 3.33333333333e-8, + "detail": "merge 10000 states into 10000; x 0.0033/s; holds 12560000 bytes for 0.010 ms", + "multiplier": 1, + "operator": "SummaryMerge", + "timing": "query_time" + }, + "4": { + "cost_per_second": 3.748e-13, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 3.33333333333e-8, + "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": 7.49600096309e-13, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 6.66666666667e-8, + "detail": "time range 600s: 2 tumbling windows of states; x 0.0033/s; holds 1256 bytes for 0.020 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "7": { + "cost_per_second": 7.50563086883e-13, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 6.66666666667e-8, + "detail": "merge 20000 states into 10000; x 0.0033/s; holds 12560000 bytes for 0.020 ms", + "multiplier": 1, + "operator": "SummaryMerge", + "timing": "query_time" + }, + "8": { + "cost_per_second": 3.748e-13, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 3.33333333333e-8, + "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": 40.5630863111, + "cpu_ops_per_second": 6444.44444444, + "disk_bytes": 12800000, + "peak_cpu_cores": 3, + "peak_memory_bytes": 46402704, + "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": "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": 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": "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": 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": 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": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 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": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "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": [ + { + "guarantee": null, + "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 + }, + { + "guarantee": null, + "id": 1, + "lifetime": { + "OneEvaluation": "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": "query_time" + }, + "parameters": { + "Kll": { + "k": 2863 + } + }, + "payload": { + "ASAP": { + "SummaryTumblingWindowChain": { + "child": 0, + "filter": null, + "input": { + "item": null, + "weight": { + "Column": "SampleValue" + } + }, + "reduction": "PerEntity", + "summary_type": { + "Sketch": "Kll" + }, + "tumbling_window_width_ms": 300000 + } + } + } + }, + { + "guarantee": null, + "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": 2863 + } + }, + "payload": { + "NonASAP": { + "TimeRange": { + "child": 1, + "kind": "range", + "range": { + "nanos": 0, + "secs": 300 + } + } + } + } + }, + { + "guarantee": null, + "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": 2863 + } + }, + "payload": { + "ASAP": { + "SummaryMerge": { + "children": [ + 2 + ] + } + } + } + }, + { + "guarantee": null, + "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 + } + } + } + }, + { + "guarantee": null, + "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 + } + } + ] + } + } + } + }, + { + "guarantee": null, + "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": 2863 + } + }, + "payload": { + "NonASAP": { + "TimeRange": { + "child": 1, + "kind": "range", + "range": { + "nanos": 0, + "secs": 600 + } + } + } + } + }, + { + "guarantee": null, + "id": 7, + "lifetime": "None", + "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": { + "SummaryMerge": { + "children": [ + 6 + ] + } + } + } + }, + { + "guarantee": null, + "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 + } + } + } + }, + { + "guarantee": null, + "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 + } + } + ] + } + } + } + }, + { + "guarantee": null, + "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": "$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 + }, + { + "guarantee": null, + "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": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 2, + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "NonASAP": { + "TimeRange": { + "child": 10, + "kind": "range", + "range": { + "nanos": 0, + "secs": 180 + } + } + } + } + }, + { + "guarantee": null, + "id": 12, + "lifetime": "None", + "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": 11, + "filter": null, + "input": { + "item": null, + "weight": { + "Column": "SampleValue" + } + }, + "reduction": "PerEntity", + "summary_type": { + "Sketch": "Kll" + } + } + } + } + }, + { + "guarantee": null, + "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 + } + } + } + }, + { + "guarantee": null, + "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/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..70565883a --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/distinct-over-time-1pct-raw-retained.json @@ -0,0 +1,589 @@ +{ + "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": 1.30526586076e-10, + "cpu_core_seconds_per_second": 0.0000116, + "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": 7.49600002454e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 6.66666666667e-7, + "detail": "time range 300s: keep 200000 of 400000 rows; x 0.0033/s; holds 32 bytes for 0.200 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "2": { + "cost_per_second": 1.49949444695e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.33333333333e-6, + "detail": "hash aggregate 200000 rows into 10000 groups; x 0.0033/s; holds 1920000 bytes for 0.400 ms", + "multiplier": 1, + "operator": "Aggregate", + "timing": "query_time" + }, + "3": { + "cost_per_second": 1.49920000491e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.33333333333e-6, + "detail": "time range 600s: keep 400000 of 400000 rows; x 0.0033/s; holds 32 bytes for 0.400 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "4": { + "cost_per_second": 2.9994796388e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 2.66666666667e-6, + "detail": "hash aggregate 400000 rows into 10000 groups; x 0.0033/s; holds 3520000 bytes for 0.800 ms", + "multiplier": 1, + "operator": "Aggregate", + "timing": "query_time" + } + }, + "source": "analytical-cost-v2 (illustrative statistics)", + "usage": { + "average_memory_bytes": 83.6267306667, + "cpu_ops_per_second": 7333.33333333, + "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": [ + { + "guarantee": null, + "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 + }, + { + "guarantee": null, + "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 + } + } + } + } + }, + { + "guarantee": null, + "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": "$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" + } + } + } + }, + { + "guarantee": null, + "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 + } + } + } + } + }, + { + "guarantee": null, + "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": { + "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..30905f069 --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/distinct-over-time-5pct-raw-retained.json @@ -0,0 +1,1165 @@ +{ + "accuracy_guarantees": "enforced", + "materialized_views": [], + "materialized_views_error": "the executor cannot compile the plan's query run: invalid DAG: node 1: a tumbling-window chain is built in ingestion runs", + "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.69603577205e-11, + "cpu_core_seconds_per_second": 8.6e-6, + "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": 3.02364882555e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 2.66666666667e-6, + "detail": "build Kmv in tumbling windows of 300000 ms for 10000 groups: 400000 rows x (1 + depth 1); x 0.0033/s; holds 82320000 bytes for 0.800 ms", + "multiplier": 1, + "operator": "SummaryTumblingWindowChain", + "timing": "query_time" + }, + "2": { + "cost_per_second": 3.7480031561e-13, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 3.33333333333e-8, + "detail": "time range 300s: 1 tumbling windows of states; x 0.0033/s; holds 8232 bytes for 0.010 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "3": { + "cost_per_second": 3.77956103194e-13, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 3.33333333333e-8, + "detail": "merge 10000 states into 10000; x 0.0033/s; holds 82320000 bytes for 0.010 ms", + "multiplier": 1, + "operator": "SummaryMerge", + "timing": "query_time" + }, + "4": { + "cost_per_second": 3.748e-13, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 3.33333333333e-8, + "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": 7.49600631221e-13, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 6.66666666667e-8, + "detail": "time range 600s: 2 tumbling windows of states; x 0.0033/s; holds 8232 bytes for 0.020 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "7": { + "cost_per_second": 7.55912206388e-13, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 6.66666666667e-8, + "detail": "merge 20000 states into 10000; x 0.0033/s; holds 82320000 bytes for 0.020 ms", + "multiplier": 1, + "operator": "SummaryMerge", + "timing": "query_time" + }, + "8": { + "cost_per_second": 3.748e-13, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 3.33333333333e-8, + "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": 227.753004533, + "cpu_ops_per_second": 4333.33333333, + "disk_bytes": 12800000, + "peak_cpu_cores": 2, + "peak_memory_bytes": 246976560, + "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": [ + { + "guarantee": null, + "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 + }, + { + "guarantee": null, + "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": 26656 + } + }, + "payload": { + "ASAP": { + "SummaryTumblingWindowChain": { + "child": 0, + "filter": null, + "input": { + "item": null, + "weight": { + "Column": "SampleValue" + } + }, + "reduction": "PerEntity", + "summary_type": { + "Sketch": "Kmv" + }, + "tumbling_window_width_ms": 300000 + } + } + } + }, + { + "guarantee": null, + "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": 26656 + } + }, + "payload": { + "NonASAP": { + "TimeRange": { + "child": 1, + "kind": "range", + "range": { + "nanos": 0, + "secs": 300 + } + } + } + } + }, + { + "guarantee": null, + "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": 26656 + } + }, + "payload": { + "ASAP": { + "SummaryMerge": { + "children": [ + 2 + ] + } + } + } + }, + { + "guarantee": null, + "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 + } + } + } + }, + { + "guarantee": null, + "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 + } + } + ] + } + } + } + }, + { + "guarantee": null, + "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": 26656 + } + }, + "payload": { + "NonASAP": { + "TimeRange": { + "child": 1, + "kind": "range", + "range": { + "nanos": 0, + "secs": 600 + } + } + } + } + }, + { + "guarantee": null, + "id": 7, + "lifetime": "None", + "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": { + "SummaryMerge": { + "children": [ + 6 + ] + } + } + } + }, + { + "guarantee": null, + "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 + } + } + } + }, + { + "guarantee": null, + "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..40f9efef8 --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/distinct-two-forms-raw-retained.json @@ -0,0 +1,899 @@ +{ + "accuracy_guarantees": "enforced", + "materialized_views": [], + "materialized_views_error": "the executor cannot compile the plan's query run: invalid DAG: node 2: invalid DAG: aggregate intent has no native implementation", + "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": 2.4029085429e-10, + "cpu_core_seconds_per_second": 0.00002133335, + "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": 1.87400000613e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-7, + "detail": "time range 15s: keep 10000 of 200000 rows; x 0.0167/s; holds 32 bytes for 0.010 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "2": { + "cost_per_second": 1.8740000046e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-7, + "detail": "hash aggregate 10000 rows into 1 groups; x 0.0167/s; holds 24 bytes for 0.010 ms", + "multiplier": 1, + "operator": "Aggregate", + "timing": "query_time" + }, + "3": { + "cost_per_second": 1.8740000046e-16, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-11, + "detail": "hash aggregate 1 rows into 1 groups; x 0.0167/s; holds 24 bytes for 0.000 ms", + "multiplier": 1, + "operator": "Aggregate", + "timing": "query_time" + }, + "4": { + "cost_per_second": 3.74800001227e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 3.33333333333e-6, + "detail": "time range 300s: keep 200000 of 200000 rows; x 0.0167/s; holds 32 bytes for 0.200 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "5": { + "cost_per_second": 3.77956103194e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 3.33333333333e-6, + "detail": "build Kmv into 10000 states: 200000 rows x depth 1; x 0.0167/s; holds 82320000 bytes for 0.200 ms", + "multiplier": 1, + "operator": "SummaryAgg", + "timing": "query_time" + }, + "6": { + "cost_per_second": 1.874e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-7, + "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": 364.000121334, + "cpu_ops_per_second": 10666.6833333, + "disk_bytes": 6400000, + "peak_cpu_cores": 2, + "peak_memory_bytes": 88720144, + "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": [ + { + "guarantee": null, + "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 + }, + { + "guarantee": null, + "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 + } + } + } + } + }, + { + "guarantee": null, + "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": [] + } + } + } + } + }, + { + "guarantee": null, + "id": 3, + "lifetime": "None", + "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": [] + } + } + } + } + }, + { + "guarantee": null, + "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 + } + } + } + } + }, + { + "guarantee": null, + "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" + } + } + } + } + }, + { + "guarantee": null, + "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 + } + } + } + }, + { + "guarantee": null, + "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..243b561b4 --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/entropy-and-distinct-raw-retained.json @@ -0,0 +1,715 @@ +{ + "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": 3.11438870433e-10, + "cpu_core_seconds_per_second": 0.0000276666666667, + "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": 3.75045372454e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 3.33333333333e-6, + "detail": "time range 300s: keep 200000 of 200000 rows; x 0.0167/s; holds 6400000 bytes for 0.200 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "2": { + "cost_per_second": 3.77956103194e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 3.33333333333e-6, + "detail": "build Kmv into 10000 states: 200000 rows x depth 1; x 0.0167/s; holds 82320000 bytes for 0.200 ms", + "multiplier": 1, + "operator": "SummaryAgg", + "timing": "query_time" + }, + "3": { + "cost_per_second": 1.874e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-7, + "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": 7.49747223473e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 6.66666666667e-6, + "detail": "hash aggregate 200000 rows into 10000 groups; x 0.0167/s; holds 1920000 bytes for 0.400 ms", + "multiplier": 1, + "operator": "Aggregate", + "timing": "query_time" + } + }, + "source": "analytical-cost-v2 (illustrative statistics)", + "usage": { + "average_memory_bytes": 308.533786667, + "cpu_ops_per_second": 17000.0, + "disk_bytes": 6400000, + "peak_cpu_cores": 2, + "peak_memory_bytes": 90640064, + "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": [ + { + "guarantee": null, + "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 + }, + { + "guarantee": null, + "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 + } + } + } + } + }, + { + "guarantee": null, + "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": 106263 + } + }, + "payload": { + "ASAP": { + "SummaryAgg": { + "child": 1, + "filter": null, + "input": { + "item": null, + "weight": { + "Column": "SampleValue" + } + }, + "reduction": "PerEntity", + "summary_type": { + "Sketch": "Kmv" + } + } + } + } + }, + { + "guarantee": null, + "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 + } + } + } + }, + { + "guarantee": null, + "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 + } + } + ] + } + } + } + }, + { + "guarantee": null, + "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": { + "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..616b3d347 --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/entropy-over-time-raw-retained.json @@ -0,0 +1,361 @@ +{ + "accuracy_guarantees": "enforced", + "materialized_views": [], + "queries": [ + "entropy_over_time(data[5m])" + ], + "selected": { + "accepted": [ + { + "accepted_metric": null, + "sketches": [], + "summary": "accepted exact" + } + ], + "cost": { + "cost_per_second": 2.69870722985e-10, + "cpu_core_seconds_per_second": 0.000024, + "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": 3.74800001227e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 3.33333333333e-6, + "detail": "time range 300s: keep 200000 of 200000 rows; x 0.0167/s; holds 32 bytes for 0.200 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "2": { + "cost_per_second": 7.49747223473e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 6.66666666667e-6, + "detail": "hash aggregate 200000 rows into 10000 groups; x 0.0167/s; holds 1920000 bytes for 0.400 ms", + "multiplier": 1, + "operator": "Aggregate", + "timing": "query_time" + } + }, + "source": "analytical-cost-v2 (illustrative statistics)", + "usage": { + "average_memory_bytes": 12.8005546667, + "cpu_ops_per_second": 13333.3333333, + "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": [ + { + "guarantee": null, + "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 + }, + { + "guarantee": null, + "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 + } + } + } + } + }, + { + "guarantee": null, + "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 a8f59d22a..be4db467f 100644 --- a/crates/devtools/tests/sketch_plan_snapshots/manifest.json +++ b/crates/devtools/tests/sketch_plan_snapshots/manifest.json @@ -74,6 +74,206 @@ "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-no-phase-raw-retained", + "covers": "two quantile_over_time over [5m] every 1m without an evaluation phase: one shared KLL build, no tumbling-window chains (#1260)", + "workload": "crates/devtools/tests/sketch_plan_snapshots/workloads/quantile-over-time-no-phase.json", + "deployment": "raw_retained" + }, + { + "id": "quantile-over-time-phase-0-raw-retained", + "covers": "the same two queries at phase 0: one 60 s KLL chain offered, query-time KLL selected", + "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 mixed intervals", + "workload": "crates/devtools/tests/sketch_plan_snapshots/workloads/mixed-quantiles.json", + "deployment": "raw_retained" + }, + { + "id": "chains-10m-5m-3m-3m-raw-retained", + "covers": "[10m] and [5m] every 5m and [3m] every 3m: chains at 300 s and 180 s, no shared 60 s chain (#1270)", + "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: the [10m] and [5m] states do not read the 10 s chain (#1270)", + "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: ingest-time chains, priced by the memory they keep", + "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): the PromQL Scans project different labels, so no rollup and two scans (#1281)", + "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): no finest common group, two scans (#1281)", + "workload": "crates/devtools/tests/sketch_plan_snapshots/workloads/rollup-quantile-disjoint-labels.json", + "deployment": "raw_retained" + }, + { + "id": "rollup-sum-chain-raw-retained", + "covers": "exact sum by (job), by (job, host) and sum: three scans, no rollup (#1281)", + "workload": "crates/devtools/tests/sketch_plan_snapshots/workloads/rollup-sum-chain.json", + "deployment": "raw_retained" + }, + { + "id": "stddev-nested-labels-raw-retained", + "covers": "exact stddev by (job) and by (job, host): no summary state, no rollup", + "workload": "crates/devtools/tests/sketch_plan_snapshots/workloads/stddev-nested-labels.json", + "deployment": "raw_retained" + }, + { + "id": "avg-nested-labels-raw-retained", + "covers": "exact avg by (job), by (job, host) and avg: Sum and Count states, not rolled up (#1281)", + "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 5 min: one Scan, the job state merges the finer KLL", + "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 by job over 5 min and by job, host over 10 min: no rollup through the finer chain (#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": "exact sum_over_time and avg_over_time over [5m]: avg as Sum / Count, the Sum state shared", + "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": "exact sum_over_time [5m] and avg_over_time [10m]: one 60 s Sum chain offered for both 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: Sort and Limit, both Limits over one Sort", + "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: no reuse across partitions, two scans (#1281)", + "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: no sketch for a Sort and Limit", + "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: topk(5) reads topk(10)", + "workload": "crates/devtools/tests/sketch_plan_snapshots/workloads/topk-rate-counter.json", + "deployment": "raw_retained" + }, + { + "id": "topk-sum-count-over-time-raw-retained", + "covers": "exact topk of sum_over_time and of count_over_time: Aggregate top_k over shared Sum and Count states", + "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": "K5 at max_error 0.01: CMS and Count Sketch heaps below the required accuracy, exact plan", + "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": "exact sum_over_time [10m] every 5m and [5m] every 1m: Sum chains at 300 s and 60 s, not shared (#1270)", + "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 %: every distinct sketch pruned, exact plan", + "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 %: one 300 s KMV chain serves both 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 a target: UnivMon has no guarantee, exact plan", + "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 at phase 0 and 30 s every 1m: chains at 30 s and 60 s", + "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 60 s chain, gcd(5 min, 7 min)", + "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 max_error 0.01 and 0.05: one root, sized for the stricter target", + "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): KMV for the first, exact for the second", + "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: no shared UnivMon; KMV and exact entropy", + "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 a target: every sketch pruned, exact plan", + "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: no DDSketch", + "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: DDSketch offered", + "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..37fb969b7 --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/mixed-quantiles-raw-retained.json @@ -0,0 +1,2152 @@ +{ + "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": "rank", + "sketches": [ + "Kll" + ], + "summary": "accepted rank (Kll)" + } + ], + "cost": { + "cost_per_second": 5.76155537119e-10, + "cpu_core_seconds_per_second": 0.0000512333333333, + "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": 3.74800001227e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 3.33333333333e-6, + "detail": "time range 300s: keep 200000 of 200000 rows; x 0.0167/s; holds 32 bytes for 0.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": 7.49600004907e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 6.66666666667e-7, + "detail": "time range 15s: keep 10000 of 10000 rows; x 0.0667/s; holds 64 bytes for 0.010 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "12": { + "cost_per_second": 2.24892882054e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 2e-6, + "detail": "hash aggregate 10000 rows into 10000 groups; x 0.0667/s; holds 560000 bytes for 0.030 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": 3.74800001227e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 3.33333333333e-6, + "detail": "time range 600s: keep 400000 of 400000 rows; x 0.0083/s; holds 32 bytes for 0.400 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "15": { + "cost_per_second": 3.75281543442e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 3.33333333333e-6, + "detail": "build Kll into 10000 states: 400000 rows x depth 1; x 0.0083/s; holds 12560000 bytes for 0.400 ms", + "multiplier": 1, + "operator": "SummaryAgg", + "timing": "query_time" + }, + "16": { + "cost_per_second": 9.37e-13, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 8.33333333333e-8, + "detail": "estimate 10000 groups x 1; x 0.0083/s", + "multiplier": 1, + "operator": "SummaryEstimate", + "timing": "query_time" + }, + "17": { + "cost_per_second": 9.37000003067e-13, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 8.33333333333e-8, + "detail": "operator: pass 10000 rows; x 0.0083/s; holds 32 bytes for 0.010 ms", + "multiplier": 1, + "operator": "Project", + "timing": "query_time" + }, + "2": { + "cost_per_second": 3.7518339446e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 3.33333333333e-6, + "detail": "build Kll into 10000 states: 200000 rows x depth 1; x 0.0167/s; holds 10000000 bytes for 0.200 ms", + "multiplier": 1, + "operator": "SummaryAgg", + "timing": "query_time" + }, + "3": { + "cost_per_second": 1.874e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-7, + "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": 1.874e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-7, + "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": 1.8740000092e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-7, + "detail": "time range 15s: keep 10000 of 10000 rows; x 0.0167/s; holds 48 bytes for 0.010 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "9": { + "cost_per_second": 3.74815335778e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 3.33333333333e-7, + "detail": "hash aggregate 10000 rows into 10000 groups; x 0.0167/s; holds 400000 bytes for 0.020 ms", + "multiplier": 1, + "operator": "Aggregate", + "timing": "query_time" + } + }, + "source": "analytical-cost-v2 (illustrative statistics)", + "usage": { + "average_memory_bytes": 76.4548688, + "cpu_ops_per_second": 24833.3333333, + "disk_bytes": 12800000, + "peak_cpu_cores": 5, + "peak_memory_bytes": 23520448, + "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" + }, + { + "consumer": 16, + "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": 15, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 17, + "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": 16, + "role": "Input", + "window": "NotApplicable" + } + ], + "nodes": [ + { + "guarantee": null, + "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 + }, + { + "guarantee": null, + "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 + } + } + } + } + }, + { + "guarantee": null, + "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" + } + } + } + } + }, + { + "guarantee": null, + "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 + } + } + } + }, + { + "guarantee": null, + "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 + } + } + ] + } + } + } + }, + { + "guarantee": null, + "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 + } + } + } + }, + { + "guarantee": null, + "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 + } + } + ] + } + } + } + }, + { + "guarantee": null, + "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 + }, + { + "guarantee": null, + "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 + } + } + } + } + }, + { + "guarantee": null, + "id": 9, + "lifetime": "None", + "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 + ] + } + } + } + } + }, + { + "guarantee": null, + "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 + }, + { + "guarantee": null, + "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 + } + } + } + } + }, + { + "guarantee": null, + "id": 12, + "lifetime": "None", + "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 + ] + } + } + } + } + }, + { + "guarantee": null, + "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 + }, + { + "guarantee": null, + "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 + } + } + } + } + }, + { + "guarantee": null, + "id": 15, + "lifetime": "None", + "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": 14, + "filter": null, + "input": { + "item": null, + "weight": { + "Column": "SampleValue" + } + }, + "reduction": "PerEntity", + "summary_type": { + "Sketch": "Kll" + } + } + } + } + }, + { + "guarantee": null, + "id": 16, + "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.75 + } + }, + "summary_input": 15 + } + } + } + }, + { + "guarantee": null, + "id": 17, + "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": 16, + "cols": [ + { + "alias": "ts", + "expr": { + "Column": 0 + } + }, + { + "alias": "value", + "expr": { + "Column": 1 + } + }, + { + "alias": "$promql_series_identity", + "expr": { + "Column": 2 + } + } + ] + } + } + } + } + ], + "roots": [ + 6, + 4, + 9, + 12, + 17 + ], + "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..36ea2f847 --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/quantile-7m-every-5m-raw-retained.json @@ -0,0 +1,594 @@ +{ + "accuracy_guarantees": "enforced", + "materialized_views": [], + "queries": [ + "quantile_over_time(0.9, data[7m])" + ], + "selected": { + "accepted": [ + { + "accepted_metric": "rank", + "sketches": [ + "Kll" + ], + "summary": "accepted rank (Kll)" + } + ], + "cost": { + "cost_per_second": 6.58256152247e-11, + "cpu_core_seconds_per_second": 5.85333333333e-6, + "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.04944000344e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 9.33333333333e-7, + "detail": "time range 420s: keep 280000 of 280000 rows; x 0.0033/s; holds 32 bytes for 0.280 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "2": { + "cost_per_second": 1.05051350449e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 9.33333333333e-7, + "detail": "build Kll into 10000 states: 280000 rows x depth 1; x 0.0033/s; holds 10000000 bytes for 0.280 ms", + "multiplier": 1, + "operator": "SummaryAgg", + "timing": "query_time" + }, + "3": { + "cost_per_second": 3.748e-13, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 3.33333333333e-8, + "detail": "estimate 10000 groups x 1; x 0.0033/s", + "multiplier": 1, + "operator": "SummaryEstimate", + "timing": "query_time" + }, + "4": { + "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": 9.33348970667, + "cpu_ops_per_second": 2866.66666667, + "disk_bytes": 8960000, + "peak_cpu_cores": 1, + "peak_memory_bytes": 10000096, + "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" + }, + { + "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" + } + ], + "nodes": [ + { + "guarantee": null, + "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 + }, + { + "guarantee": null, + "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 + } + } + } + } + }, + { + "guarantee": null, + "id": 2, + "lifetime": "None", + "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" + } + } + } + } + }, + { + "guarantee": null, + "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 + } + } + } + }, + { + "guarantee": null, + "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 + } + } + ] + } + } + } + } + ], + "roots": [ + 4 + ], + "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..9a63c342f --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/quantile-exact-raw-retained.json @@ -0,0 +1,362 @@ +{ + "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": 2.69870722985e-10, + "cpu_core_seconds_per_second": 0.000024, + "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": 3.74800001227e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 3.33333333333e-6, + "detail": "time range 300s: keep 200000 of 200000 rows; x 0.0167/s; holds 32 bytes for 0.200 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "2": { + "cost_per_second": 7.49747223473e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 6.66666666667e-6, + "detail": "hash aggregate 200000 rows into 10000 groups; x 0.0167/s; holds 1920000 bytes for 0.400 ms", + "multiplier": 1, + "operator": "Aggregate", + "timing": "query_time" + } + }, + "source": "analytical-cost-v2 (illustrative statistics)", + "usage": { + "average_memory_bytes": 12.8005546667, + "cpu_ops_per_second": 13333.3333333, + "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": [ + { + "guarantee": null, + "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 + }, + { + "guarantee": null, + "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 + } + } + } + } + }, + { + "guarantee": null, + "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-no-phase-raw-retained.json b/crates/devtools/tests/sketch_plan_snapshots/quantile-over-time-no-phase-raw-retained.json new file mode 100644 index 000000000..b8cc8e79d --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/quantile-over-time-no-phase-raw-retained.json @@ -0,0 +1,834 @@ +{ + "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.39910340096e-10, + "cpu_core_seconds_per_second": 0.0000213333333333, + "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": 3.74800001227e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 3.33333333333e-6, + "detail": "time range 300s: keep 200000 of 200000 rows; x 0.0167/s; holds 32 bytes for 0.200 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "2": { + "cost_per_second": 3.7518339446e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 3.33333333333e-6, + "detail": "build Kll into 10000 states: 200000 rows x depth 1; x 0.0167/s; holds 10000000 bytes for 0.200 ms", + "multiplier": 1, + "operator": "SummaryAgg", + "timing": "query_time" + }, + "3": { + "cost_per_second": 1.874e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-7, + "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": 1.874e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-7, + "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": 33.3338986667, + "cpu_ops_per_second": 10666.6666667, + "disk_bytes": 6400000, + "peak_cpu_cores": 2, + "peak_memory_bytes": 10000128, + "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": [ + { + "guarantee": null, + "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 + }, + { + "guarantee": null, + "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 + } + } + } + } + }, + { + "guarantee": null, + "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" + } + } + } + } + }, + { + "guarantee": null, + "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 + } + } + } + }, + { + "guarantee": null, + "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 + } + } + ] + } + } + } + }, + { + "guarantee": null, + "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 + } + } + } + }, + { + "guarantee": null, + "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-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..b8cc8e79d --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/quantile-over-time-phase-0-raw-retained.json @@ -0,0 +1,834 @@ +{ + "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.39910340096e-10, + "cpu_core_seconds_per_second": 0.0000213333333333, + "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": 3.74800001227e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 3.33333333333e-6, + "detail": "time range 300s: keep 200000 of 200000 rows; x 0.0167/s; holds 32 bytes for 0.200 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "2": { + "cost_per_second": 3.7518339446e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 3.33333333333e-6, + "detail": "build Kll into 10000 states: 200000 rows x depth 1; x 0.0167/s; holds 10000000 bytes for 0.200 ms", + "multiplier": 1, + "operator": "SummaryAgg", + "timing": "query_time" + }, + "3": { + "cost_per_second": 1.874e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-7, + "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": 1.874e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-7, + "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": 33.3338986667, + "cpu_ops_per_second": 10666.6666667, + "disk_bytes": 6400000, + "peak_cpu_cores": 2, + "peak_memory_bytes": 10000128, + "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": [ + { + "guarantee": null, + "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 + }, + { + "guarantee": null, + "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 + } + } + } + } + }, + { + "guarantee": null, + "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" + } + } + } + } + }, + { + "guarantee": null, + "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 + } + } + } + }, + { + "guarantee": null, + "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 + } + } + ] + } + } + } + }, + { + "guarantee": null, + "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 + } + } + } + }, + { + "guarantee": null, + "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..aedd5b458 --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/quantile-phase-0-and-30s-raw-retained.json @@ -0,0 +1,1156 @@ +{ + "accuracy_guarantees": "enforced", + "materialized_views": [], + "queries": [ + "quantile_over_time(0.9, data[5m])", + "quantile_over_time(0.5, 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": 4.7232468018e-10, + "cpu_core_seconds_per_second": 0.000042, + "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": 3.74800001227e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 3.33333333333e-6, + "detail": "time range 300s: keep 200000 of 200000 rows; x 0.0167/s; holds 32 bytes for 0.200 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "2": { + "cost_per_second": 3.7518339446e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 3.33333333333e-6, + "detail": "build Kll into 10000 states: 200000 rows x depth 1; x 0.0167/s; holds 10000000 bytes for 0.200 ms", + "multiplier": 1, + "operator": "SummaryAgg", + "timing": "query_time" + }, + "3": { + "cost_per_second": 1.874e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-7, + "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": 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" + }, + "6": { + "cost_per_second": 3.74800001227e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 3.33333333333e-6, + "detail": "time range 300s: keep 200000 of 200000 rows; x 0.0167/s; holds 32 bytes for 0.200 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "7": { + "cost_per_second": 3.7518339446e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 3.33333333333e-6, + "detail": "build Kll into 10000 states: 200000 rows x depth 1; x 0.0167/s; holds 10000000 bytes for 0.200 ms", + "multiplier": 1, + "operator": "SummaryAgg", + "timing": "query_time" + }, + "8": { + "cost_per_second": 1.874e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-7, + "detail": "estimate 10000 groups x 1; x 0.0167/s", + "multiplier": 1, + "operator": "SummaryEstimate", + "timing": "query_time" + }, + "9": { + "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": 66.6677866667, + "cpu_ops_per_second": 20666.6666667, + "disk_bytes": 6400000, + "peak_cpu_cores": 2, + "peak_memory_bytes": 20000192, + "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": "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": 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" + }, + { + "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" + } + ], + "nodes": [ + { + "guarantee": null, + "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 + }, + { + "guarantee": null, + "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 + } + } + } + } + }, + { + "guarantee": null, + "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" + } + } + } + } + }, + { + "guarantee": null, + "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 + } + } + } + }, + { + "guarantee": null, + "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 + } + } + ] + } + } + } + }, + { + "guarantee": null, + "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": 300000 + }, + { + "guarantee": null, + "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": 300 + } + } + } + } + }, + { + "guarantee": null, + "id": 7, + "lifetime": "None", + "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": 6, + "filter": null, + "input": { + "item": null, + "weight": { + "Column": "SampleValue" + } + }, + "reduction": "PerEntity", + "summary_type": { + "Sketch": "Kll" + } + } + } + } + }, + { + "guarantee": null, + "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 + } + } + } + }, + { + "guarantee": null, + "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": [ + 4, + 9 + ], + "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..0b824dcaf --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/quantile-two-targets-raw-retained.json @@ -0,0 +1,607 @@ +{ + "accuracy_guarantees": "enforced", + "materialized_views": [], + "queries": [ + "quantile_over_time(0.9, 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.36162401427e-10, + "cpu_core_seconds_per_second": 0.000021, + "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": 3.74800001227e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 3.33333333333e-6, + "detail": "time range 300s: keep 200000 of 200000 rows; x 0.0167/s; holds 32 bytes for 0.200 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "2": { + "cost_per_second": 3.7518339446e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 3.33333333333e-6, + "detail": "build Kll into 10000 states: 200000 rows x depth 1; x 0.0167/s; holds 10000000 bytes for 0.200 ms", + "multiplier": 1, + "operator": "SummaryAgg", + "timing": "query_time" + }, + "3": { + "cost_per_second": 1.874e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-7, + "detail": "estimate 10000 groups x 1; x 0.0167/s", + "multiplier": 1, + "operator": "SummaryEstimate", + "timing": "query_time" + }, + "4": { + "cost_per_second": 1.87406134311e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-7, + "detail": "operator: pass 10000 rows; x 0.0167/s; holds 320000 bytes for 0.010 ms", + "multiplier": 1, + "operator": "Project", + "timing": "query_time" + } + }, + "source": "analytical-cost-v2 (illustrative statistics)", + "usage": { + "average_memory_bytes": 33.3872213333, + "cpu_ops_per_second": 10333.3333333, + "disk_bytes": 6400000, + "peak_cpu_cores": 2, + "peak_memory_bytes": 10320064, + "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" + } + ], + "nodes": [ + { + "guarantee": null, + "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 + }, + { + "guarantee": null, + "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 + } + } + } + } + }, + { + "guarantee": null, + "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" + } + } + } + } + }, + { + "guarantee": null, + "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 + } + } + } + }, + { + "guarantee": null, + "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": { + "Project": { + "child": 3, + "cols": [ + { + "alias": "ts", + "expr": { + "Column": 0 + } + }, + { + "alias": "value", + "expr": { + "Column": 1 + } + }, + { + "alias": "$promql_series_identity", + "expr": { + "Column": 2 + } + } + ] + } + } + } + } + ], + "roots": [ + 4, + 4 + ], + "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..7607c1f8a --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/rollup-quantile-disjoint-labels-raw-retained.json @@ -0,0 +1,1144 @@ +{ + "accuracy_guarantees": "enforced", + "materialized_views": [], + "queries": [ + "quantile by (job) (0.9, data)", + "quantile by (host) (0.9, data)" + ], + "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.96131324157e-11, + "cpu_core_seconds_per_second": 2.63366666667e-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": 1.8740000092e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-7, + "detail": "time range 15s: keep 10000 of 10000 rows; x 0.0167/s; holds 48 bytes for 0.010 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "2": { + "cost_per_second": 1.87401713006e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-7, + "detail": "build Kll into 10 states: 10000 rows x depth 1; x 0.0167/s; holds 89360 bytes for 0.010 ms", + "multiplier": 1, + "operator": "SummaryAgg", + "timing": "query_time" + }, + "3": { + "cost_per_second": 1.874e-15, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-10, + "detail": "estimate 10 groups x 1; x 0.0167/s", + "multiplier": 1, + "operator": "SummaryEstimate", + "timing": "query_time" + }, + "4": { + "cost_per_second": 1.87400004601e-15, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-10, + "detail": "operator: pass 10 rows; x 0.0167/s; holds 240 bytes for 0.000 ms", + "multiplier": 1, + "operator": "Project", + "timing": "query_time" + }, + "5": { + "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" + }, + "6": { + "cost_per_second": 1.8740000092e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-7, + "detail": "time range 15s: keep 10000 of 10000 rows; x 0.0167/s; holds 48 bytes for 0.010 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "7": { + "cost_per_second": 1.87416715998e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-7, + "detail": "build Kll into 1000 states: 10000 rows x depth 1; x 0.0167/s; holds 872000 bytes for 0.010 ms", + "multiplier": 1, + "operator": "SummaryAgg", + "timing": "query_time" + }, + "8": { + "cost_per_second": 1.874e-13, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-8, + "detail": "estimate 1000 groups x 1; x 0.0167/s", + "multiplier": 1, + "operator": "SummaryEstimate", + "timing": "query_time" + }, + "9": { + "cost_per_second": 1.8740000046e-13, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-8, + "detail": "operator: pass 1000 rows; x 0.0167/s; holds 24 bytes for 0.001 ms", + "multiplier": 1, + "operator": "Project", + "timing": "query_time" + } + }, + "source": "analytical-cost-v2 (illustrative statistics)", + "usage": { + "average_memory_bytes": 0.160335906667, + "cpu_ops_per_second": 1033.66666667, + "disk_bytes": 480000, + "peak_cpu_cores": 2, + "peak_memory_bytes": 961816, + "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": 3, + "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": 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": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "quantile", + "nullable": false + } + ], + "time_index": null, + "unique_keys": [ + [ + 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": "host", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 3, + 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": "host", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "$promql_series_identity", + "nullable": false + } + ], + "time_index": 0, + "unique_keys": [ + [ + 3, + 0 + ] + ] + }, + "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": "host", + "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": "host", + "nullable": true + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "quantile", + "nullable": false + } + ], + "time_index": null, + "unique_keys": [ + [ + 0 + ] + ] + }, + "producer": 8, + "role": "Input", + "window": "NotApplicable" + } + ], + "nodes": [ + { + "guarantee": null, + "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 + }, + { + "guarantee": null, + "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 + } + } + } + } + }, + { + "guarantee": null, + "id": 2, + "lifetime": "None", + "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": 1404 + } + }, + "payload": { + "ASAP": { + "SummaryAgg": { + "child": 1, + "filter": null, + "input": { + "item": null, + "weight": { + "Column": "SampleValue" + } + }, + "reduction": { + "Reduce": [ + 2 + ] + }, + "summary_type": { + "Sketch": "Kll" + } + } + } + } + }, + { + "guarantee": null, + "id": 3, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "quantile", + "nullable": false + } + ], + "time_index": null, + "unique_keys": [ + [ + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "ASAP": { + "SummaryEstimate": { + "query": { + "Quantile": { + "q": 0.9 + } + }, + "summary_input": 2 + } + } + } + }, + { + "guarantee": null, + "id": 4, + "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": { + "Project": { + "child": 3, + "cols": [ + { + "alias": "job", + "expr": { + "Column": 0 + } + }, + { + "alias": "quantile_0_9", + "expr": { + "Column": 1 + } + } + ] + } + } + } + }, + { + "guarantee": null, + "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": "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 + }, + { + "guarantee": null, + "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": "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": 5, + "kind": "instant", + "range": { + "nanos": 0, + "secs": 15 + } + } + } + } + }, + { + "guarantee": null, + "id": 7, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "utf8" + }, + "name": "host", + "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": { + "SummaryAgg": { + "child": 6, + "filter": null, + "input": { + "item": null, + "weight": { + "Column": "SampleValue" + } + }, + "reduction": { + "Reduce": [ + 2 + ] + }, + "summary_type": { + "Sketch": "Kll" + } + } + } + } + }, + { + "guarantee": null, + "id": 8, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "utf8" + }, + "name": "host", + "nullable": true + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "quantile", + "nullable": false + } + ], + "time_index": null, + "unique_keys": [ + [ + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "ASAP": { + "SummaryEstimate": { + "query": { + "Quantile": { + "q": 0.9 + } + }, + "summary_input": 7 + } + } + } + }, + { + "guarantee": null, + "id": 9, + "lifetime": "None", + "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": { + "Project": { + "child": 8, + "cols": [ + { + "alias": "host", + "expr": { + "Column": 0 + } + }, + { + "alias": "quantile_0_9", + "expr": { + "Column": 1 + } + } + ] + } + } + } + } + ], + "roots": [ + 4, + 9 + ], + "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..498ce5091 --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/rollup-quantile-nested-labels-raw-retained.json @@ -0,0 +1,990 @@ +{ + "accuracy_guarantees": "enforced", + "materialized_views": [], + "queries": [ + "quantile by (job) (0.9, data)", + "quantile by (job, host) (0.9, data)" + ], + "selected": { + "accepted": [ + { + "accepted_metric": "rank", + "sketches": [ + "Kll" + ], + "summary": "accepted rank (Kll)" + }, + { + "accepted_metric": null, + "sketches": [], + "summary": "accepted exact" + } + ], + "cost": { + "cost_per_second": 3.5984887347e-11, + "cpu_core_seconds_per_second": 3.20033333333e-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", + "multiplier": 1, + "operator": "Scan", + "timing": "query_time" + }, + "1": { + "cost_per_second": 1.8740000092e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-7, + "detail": "time range 15s: keep 10000 of 10000 rows; x 0.0167/s; holds 48 bytes for 0.010 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "2": { + "cost_per_second": 1.87401713006e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-7, + "detail": "build Kll into 10 states: 10000 rows x depth 1; x 0.0167/s; holds 89360 bytes for 0.010 ms", + "multiplier": 1, + "operator": "SummaryAgg", + "timing": "query_time" + }, + "3": { + "cost_per_second": 1.874e-15, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-10, + "detail": "estimate 10 groups x 1; x 0.0167/s", + "multiplier": 1, + "operator": "SummaryEstimate", + "timing": "query_time" + }, + "4": { + "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" + }, + "5": { + "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" + }, + "6": { + "cost_per_second": 1.87400001227e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-7, + "detail": "time range 15s: keep 10000 of 10000 rows; x 0.0167/s; holds 64 bytes for 0.010 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "7": { + "cost_per_second": 5.62232205135e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 5e-7, + "detail": "hash aggregate 10000 rows into 10000 groups; x 0.0167/s; holds 560000 bytes for 0.030 ms", + "multiplier": 1, + "operator": "Aggregate", + "timing": "query_time" + } + }, + "source": "analytical-cost-v2 (illustrative statistics)", + "usage": { + "average_memory_bytes": 0.295037337333, + "cpu_ops_per_second": 1333.66666667, + "disk_bytes": 640000, + "peak_cpu_cores": 2, + "peak_memory_bytes": 649608, + "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": 3, + "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": 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": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "quantile", + "nullable": false + } + ], + "time_index": null, + "unique_keys": [ + [ + 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": "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": 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": "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": 6, + "role": "Input", + "window": "NotApplicable" + } + ], + "nodes": [ + { + "guarantee": null, + "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 + }, + { + "guarantee": null, + "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 + } + } + } + } + }, + { + "guarantee": null, + "id": 2, + "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": 1404 + } + }, + "payload": { + "ASAP": { + "SummaryAgg": { + "child": 1, + "filter": null, + "input": { + "item": null, + "weight": { + "Column": "SampleValue" + } + }, + "reduction": { + "Reduce": [ + 2 + ] + }, + "summary_type": { + "Sketch": "Kll" + } + } + } + } + }, + { + "guarantee": null, + "id": 3, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "quantile", + "nullable": false + } + ], + "time_index": null, + "unique_keys": [ + [ + 0 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "ASAP": { + "SummaryEstimate": { + "query": { + "Quantile": { + "q": 0.9 + } + }, + "summary_input": 2 + } + } + } + }, + { + "guarantee": null, + "id": 4, + "lifetime": "None", + "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": { + "Project": { + "child": 3, + "cols": [ + { + "alias": "job", + "expr": { + "Column": 0 + } + }, + { + "alias": "quantile_0_9", + "expr": { + "Column": 1 + } + } + ] + } + } + } + }, + { + "guarantee": null, + "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": "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 + }, + { + "guarantee": null, + "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": "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": 5, + "kind": "instant", + "range": { + "nanos": 0, + "secs": 15 + } + } + } + } + }, + { + "guarantee": null, + "id": 7, + "lifetime": "None", + "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": 6, + "filters": [], + "having": null, + "measures": [ + { + "col": null, + "kind": "quantile", + "q": 0.9 + } + ], + "output_names": [ + "" + ], + "reduction": { + "Reduce": [ + 2, + 3 + ] + } + } + } + } + } + ], + "roots": [ + 4, + 7 + ], + "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..0898a40bd --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/rollup-sum-chain-raw-retained.json @@ -0,0 +1,1306 @@ +{ + "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": 4.57275816599e-11, + "cpu_core_seconds_per_second": 4.06683333333e-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", + "multiplier": 1, + "operator": "Scan", + "timing": "query_time" + }, + "1": { + "cost_per_second": 1.8740000092e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-7, + "detail": "time range 15s: keep 10000 of 10000 rows; x 0.0167/s; holds 48 bytes for 0.010 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "10": { + "cost_per_second": 1.8740000046e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-7, + "detail": "hash aggregate 10000 rows into 1 groups; x 0.0167/s; holds 24 bytes for 0.010 ms", + "multiplier": 1, + "operator": "Aggregate", + "timing": "query_time" + }, + "2": { + "cost_per_second": 1.87400010735e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-7, + "detail": "build exact Sum accumulator into 10 states: 10000 rows x depth 1; x 0.0167/s; holds 560 bytes for 0.010 ms", + "multiplier": 1, + "operator": "SummaryAgg", + "timing": "query_time" + }, + "3": { + "cost_per_second": 1.874e-15, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-10, + "detail": "finalize 10 accumulators; x 0.0167/s", + "multiplier": 1, + "operator": "FinalizeExactAccumulator", + "timing": "query_time" + }, + "4": { + "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" + }, + "5": { + "cost_per_second": 1.87400001227e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-7, + "detail": "time range 15s: keep 10000 of 10000 rows; x 0.0167/s; holds 64 bytes for 0.010 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "6": { + "cost_per_second": 1.87410735045e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-7, + "detail": "build exact Sum accumulator into 10000 states: 10000 rows x depth 1; x 0.0167/s; holds 560000 bytes for 0.010 ms", + "multiplier": 1, + "operator": "SummaryAgg", + "timing": "query_time" + }, + "7": { + "cost_per_second": 1.874e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-7, + "detail": "finalize 10000 accumulators; x 0.0167/s", + "multiplier": 1, + "operator": "FinalizeExactAccumulator", + "timing": "query_time" + }, + "8": { + "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" + }, + "9": { + "cost_per_second": 1.87400000613e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-7, + "detail": "time range 15s: keep 10000 of 10000 rows; x 0.0167/s; holds 32 bytes for 0.010 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + } + }, + "source": "analytical-cost-v2 (illustrative statistics)", + "usage": { + "average_memory_bytes": 0.0936024, + "cpu_ops_per_second": 1666.83333333, + "disk_bytes": 640000, + "peak_cpu_cores": 3, + "peak_memory_bytes": 560872, + "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": 3, + "data_state": { + "primitive": "SummaryState", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "ExactAggregate": [ + "Sum", + "Sum" + ] + }, + "name": "state", + "nullable": false + } + ], + "time_index": null, + "unique_keys": [ + [ + 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": "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": 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": "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": 5, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 7, + "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": 6, + "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": "$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": "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": 9, + "role": "Input", + "window": "NotApplicable" + } + ], + "nodes": [ + { + "guarantee": null, + "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 + }, + { + "guarantee": null, + "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 + } + } + } + } + }, + { + "guarantee": null, + "id": 2, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "utf8" + }, + "name": "job", + "nullable": true + }, + { + "dtype": { + "ExactAggregate": [ + "Sum", + "Sum" + ] + }, + "name": "state", + "nullable": false + } + ], + "time_index": null, + "unique_keys": [ + [ + 0 + ] + ] + }, + "output_state": { + "primitive": "SummaryState", + "timing": "query_time" + }, + "payload": { + "ASAP": { + "SummaryAgg": { + "child": 1, + "filter": null, + "input": { + "item": null, + "weight": { + "Column": "SampleValue" + } + }, + "reduction": { + "Reduce": [ + 2 + ] + }, + "summary_type": { + "ExactAggregate": [ + "Sum", + "Sum" + ] + } + } + } + } + }, + { + "guarantee": null, + "id": 3, + "lifetime": "None", + "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": { + "ASAP": { + "FinalizeExactAccumulator": { + "child": 2 + } + } + } + }, + { + "guarantee": null, + "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": { + "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 + }, + { + "guarantee": null, + "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": "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": 4, + "kind": "instant", + "range": { + "nanos": 0, + "secs": 15 + } + } + } + } + }, + { + "guarantee": null, + "id": 6, + "lifetime": "None", + "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": 5, + "filter": null, + "input": { + "item": null, + "weight": { + "Column": "SampleValue" + } + }, + "reduction": { + "Reduce": [ + 2, + 3 + ] + }, + "summary_type": { + "ExactAggregate": [ + "Sum", + "Sum" + ] + } + } + } + } + }, + { + "guarantee": null, + "id": 7, + "lifetime": "None", + "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": 6 + } + } + } + }, + { + "guarantee": null, + "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": "$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 + }, + { + "guarantee": null, + "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": { + "TimeRange": { + "child": 8, + "kind": "instant", + "range": { + "nanos": 0, + "secs": 15 + } + } + } + } + }, + { + "guarantee": null, + "id": 10, + "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": 9, + "filters": [], + "having": null, + "measures": [ + { + "col": null, + "kind": "sum" + } + ], + "output_names": [ + "" + ], + "reduction": { + "Reduce": [] + } + } + } + } + } + ], + "roots": [ + 3, + 7, + 10 + ], + "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..f98a9ba6f --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/sign-non-negative-raw-retained.json @@ -0,0 +1,940 @@ +{ + "accuracy_guarantees": "enforced", + "materialized_views": [], + "materialized_views_error": "the executor cannot compile the plan's query run: invalid DAG: node 4: invalid DAG: aggregate output names differ from measures", + "queries": [ + "quantile_over_time(0.9, data[5m])", + "topk(5, sum_over_time(data[5m]))" + ], + "selected": { + "accepted": [ + { + "accepted_metric": "rank", + "sketches": [ + "Kll" + ], + "summary": "accepted rank (Kll)" + }, + { + "accepted_metric": null, + "sketches": [], + "summary": "accepted exact" + } + ], + "cost": { + "cost_per_second": 2.77417039561e-10, + "cpu_core_seconds_per_second": 0.0000246666666667, + "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": 3.75045372454e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 3.33333333333e-6, + "detail": "time range 300s: keep 200000 of 200000 rows; x 0.0167/s; holds 6400000 bytes for 0.200 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "2": { + "cost_per_second": 3.7482147009e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 3.33333333333e-6, + "detail": "build exact Sum accumulator into 10000 states: 200000 rows x depth 1; x 0.0167/s; holds 560000 bytes for 0.200 ms", + "multiplier": 1, + "operator": "SummaryAgg", + "timing": "query_time" + }, + "3": { + "cost_per_second": 1.874e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-7, + "detail": "finalize 10000 accumulators; x 0.0167/s", + "multiplier": 1, + "operator": "FinalizeExactAccumulator", + "timing": "query_time" + }, + "4": { + "cost_per_second": 1.87401533885e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-7, + "detail": "hash aggregate 10000 rows into 1 groups; x 0.0167/s; holds 80016 bytes for 0.010 ms", + "multiplier": 1, + "operator": "Aggregate", + "timing": "query_time" + }, + "5": { + "cost_per_second": 3.7518339446e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 3.33333333333e-6, + "detail": "build Kll into 10000 states: 200000 rows x depth 1; x 0.0167/s; holds 10000000 bytes for 0.200 ms", + "multiplier": 1, + "operator": "SummaryAgg", + "timing": "query_time" + }, + "6": { + "cost_per_second": 1.874e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-7, + "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": 56.5471226667, + "cpu_ops_per_second": 14000.0, + "disk_bytes": 6400000, + "peak_cpu_cores": 2, + "peak_memory_bytes": 17040080, + "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": [ + "Sum", + "Sum" + ] + }, + "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": "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": 6, + "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": 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": "quantile", + "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": [ + { + "guarantee": null, + "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 + }, + { + "guarantee": null, + "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 + } + } + } + } + }, + { + "guarantee": null, + "id": 2, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "ExactAggregate": [ + "Sum", + "Sum" + ] + }, + "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": [ + "Sum", + "Sum" + ] + } + } + } + } + }, + { + "guarantee": null, + "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 + } + } + } + }, + { + "guarantee": null, + "id": 4, + "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": 3, + "filters": [], + "having": null, + "measures": [ + { + "k": 5, + "kind": "top_k" + } + ], + "output_names": [], + "reduction": { + "Reduce": [] + } + } + } + } + }, + { + "guarantee": null, + "id": 5, + "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": 132 + } + }, + "payload": { + "ASAP": { + "SummaryAgg": { + "child": 1, + "filter": null, + "input": { + "item": null, + "weight": { + "Column": "SampleValue" + } + }, + "reduction": "PerEntity", + "summary_type": { + "Sketch": "Kll" + } + } + } + } + }, + { + "guarantee": null, + "id": 6, + "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": 5 + } + } + } + }, + { + "guarantee": null, + "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, + 4 + ], + "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..77f3eac16 --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/sign-unknown-raw-retained.json @@ -0,0 +1,934 @@ +{ + "accuracy_guarantees": "enforced", + "materialized_views": [], + "materialized_views_error": "the executor cannot compile the plan's query run: invalid DAG: node 4: invalid DAG: aggregate output names differ from measures", + "queries": [ + "quantile_over_time(0.9, data[5m])", + "topk(5, sum_over_time(data[5m]))" + ], + "selected": { + "accepted": [ + { + "accepted_metric": "rank", + "sketches": [ + "Kll" + ], + "summary": "accepted rank (Kll)" + }, + { + "accepted_metric": null, + "sketches": [], + "summary": "accepted exact" + } + ], + "cost": { + "cost_per_second": 2.77417039561e-10, + "cpu_core_seconds_per_second": 0.0000246666666667, + "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": 3.75045372454e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 3.33333333333e-6, + "detail": "time range 300s: keep 200000 of 200000 rows; x 0.0167/s; holds 6400000 bytes for 0.200 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "2": { + "cost_per_second": 3.7482147009e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 3.33333333333e-6, + "detail": "build exact Sum accumulator into 10000 states: 200000 rows x depth 1; x 0.0167/s; holds 560000 bytes for 0.200 ms", + "multiplier": 1, + "operator": "SummaryAgg", + "timing": "query_time" + }, + "3": { + "cost_per_second": 1.874e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-7, + "detail": "finalize 10000 accumulators; x 0.0167/s", + "multiplier": 1, + "operator": "FinalizeExactAccumulator", + "timing": "query_time" + }, + "4": { + "cost_per_second": 1.87401533885e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-7, + "detail": "hash aggregate 10000 rows into 1 groups; x 0.0167/s; holds 80016 bytes for 0.010 ms", + "multiplier": 1, + "operator": "Aggregate", + "timing": "query_time" + }, + "5": { + "cost_per_second": 3.7518339446e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 3.33333333333e-6, + "detail": "build Kll into 10000 states: 200000 rows x depth 1; x 0.0167/s; holds 10000000 bytes for 0.200 ms", + "multiplier": 1, + "operator": "SummaryAgg", + "timing": "query_time" + }, + "6": { + "cost_per_second": 1.874e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-7, + "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": 56.5471226667, + "cpu_ops_per_second": 14000.0, + "disk_bytes": 6400000, + "peak_cpu_cores": 2, + "peak_memory_bytes": 17040080, + "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": [ + "Sum", + "Sum" + ] + }, + "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": "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": 6, + "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": 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": "quantile", + "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": [ + { + "guarantee": null, + "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 + }, + { + "guarantee": null, + "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 + } + } + } + } + }, + { + "guarantee": null, + "id": 2, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "ExactAggregate": [ + "Sum", + "Sum" + ] + }, + "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": [ + "Sum", + "Sum" + ] + } + } + } + } + }, + { + "guarantee": null, + "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 + } + } + } + }, + { + "guarantee": null, + "id": 4, + "lifetime": "None", + "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": 3, + "filters": [], + "having": null, + "measures": [ + { + "k": 5, + "kind": "top_k" + } + ], + "output_names": [], + "reduction": { + "Reduce": [] + } + } + } + } + }, + { + "guarantee": null, + "id": 5, + "lifetime": "None", + "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": 132 + } + }, + "payload": { + "ASAP": { + "SummaryAgg": { + "child": 1, + "filter": null, + "input": { + "item": null, + "weight": { + "Column": "SampleValue" + } + }, + "reduction": "PerEntity", + "summary_type": { + "Sketch": "Kll" + } + } + } + } + }, + { + "guarantee": null, + "id": 6, + "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": 5 + } + } + } + }, + { + "guarantee": null, + "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, + 4 + ], + "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..52f556360 --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/sql-rollup-quantile-different-windows-raw-retained.json @@ -0,0 +1,1271 @@ +{ + "accuracy_guarantees": "enforced", + "materialized_views": [], + "materialized_views_error": "the executor cannot compile the plan's query run: invalid DAG: node 2: 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": "rank", + "sketches": [ + "Kll" + ], + "summary": "accepted rank (Kll)" + } + ], + "cost": { + "cost_per_second": 6.66226478554e-10, + "cpu_core_seconds_per_second": 0.0000591671666667, + "per_node": { + "0": { + "cost_per_second": 4.35621896141e-10, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.0000386666666667, + "detail": "scan 400000 samples; x 0.0167/s; holds 19200000 bytes for 2.320 ms; keeps 19200000 bytes of raw data on disk", + "multiplier": 1, + "operator": "Scan", + "timing": "query_time" + }, + "1": { + "cost_per_second": 7.49600003681e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 6.66666666667e-6, + "detail": "time range 600s: keep 400000 of 400000 rows; x 0.0167/s; holds 48 bytes for 0.400 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "10": { + "cost_per_second": 1.87400004601e-15, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-10, + "detail": "operator: pass 10 rows; x 0.0167/s; holds 240 bytes for 0.000 ms", + "multiplier": 1, + "operator": "Project", + "timing": "query_time" + }, + "2": { + "cost_per_second": 7.50563086883e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 6.66666666667e-6, + "detail": "build Kll into 10000 states: 400000 rows x depth 1; x 0.0167/s; holds 12560000 bytes for 0.400 ms", + "multiplier": 1, + "operator": "SummaryAgg", + "timing": "query_time" + }, + "3": { + "cost_per_second": 1.874e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-7, + "detail": "estimate 10000 groups x 1; x 0.0167/s", + "multiplier": 1, + "operator": "SummaryEstimate", + "timing": "query_time" + }, + "4": { + "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" + }, + "5": { + "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" + }, + "6": { + "cost_per_second": 3.7480000184e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 3.33333333333e-6, + "detail": "time range 300s: keep 200000 of 400000 rows; x 0.0167/s; holds 48 bytes for 0.200 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "7": { + "cost_per_second": 3.74806511572e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 3.33333333333e-6, + "detail": "build Kll into 10 states: 200000 rows x depth 1; x 0.0167/s; holds 169840 bytes for 0.200 ms", + "multiplier": 1, + "operator": "SummaryAgg", + "timing": "query_time" + }, + "8": { + "cost_per_second": 1.874e-15, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-10, + "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": 826.699960044, + "cpu_ops_per_second": 27167.1666667, + "disk_bytes": 19200000, + "peak_cpu_cores": 2, + "peak_memory_bytes": 31930280, + "scanned_bytes_per_second": 320000.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": "SummaryState", + "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": { + "Sketch": "Kll" + }, + "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": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "host", + "nullable": true + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "quantile", + "nullable": true + } + ], + "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": "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": 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": 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": 7, + "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": 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": [ + { + "guarantee": null, + "id": 0, + "lifetime": { + "OneEvaluation": "Memory" + }, + "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 + }, + { + "guarantee": null, + "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 + } + } + } + } + }, + { + "guarantee": null, + "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": { + "Sketch": "Kll" + }, + "name": "state", + "nullable": false + } + ], + "time_index": null, + "unique_keys": [ + [ + 0, + 1 + ] + ] + }, + "output_state": { + "primitive": "SummaryState", + "timing": "query_time" + }, + "parameters": { + "Kll": { + "k": 1404 + } + }, + "payload": { + "ASAP": { + "SummaryAgg": { + "child": 1, + "filter": null, + "input": { + "item": null, + "weight": { + "Column": { + "Named": "value" + } + } + }, + "reduction": { + "Reduce": [ + 1, + 2 + ] + }, + "summary_type": { + "Sketch": "Kll" + } + } + } + } + }, + { + "guarantee": null, + "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": "quantile", + "nullable": true + } + ], + "time_index": null, + "unique_keys": [ + [ + 0, + 1 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "ASAP": { + "SummaryEstimate": { + "query": { + "Quantile": { + "q": 0.9 + } + }, + "summary_input": 2 + } + } + } + }, + { + "guarantee": null, + "id": 4, + "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": "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": { + "Project": { + "child": 3, + "cols": [ + { + "alias": "job", + "expr": { + "Column": 0 + } + }, + { + "alias": "host", + "expr": { + "Column": 1 + } + }, + { + "alias": "approx_percentile_cont(data.value,Float64(0.9))", + "expr": { + "Column": 2 + } + } + ] + } + } + } + }, + { + "guarantee": null, + "id": 5, + "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": 4, + "cols": [ + { + "alias": null, + "expr": { + "Column": 0 + } + }, + { + "alias": null, + "expr": { + "Column": 1 + } + }, + { + "alias": "value", + "expr": { + "Column": 2 + } + } + ] + } + } + } + }, + { + "guarantee": null, + "id": 6, + "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 + } + } + } + } + }, + { + "guarantee": null, + "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": { + "SummaryAgg": { + "child": 6, + "filter": null, + "input": { + "item": null, + "weight": { + "Column": { + "Named": "value" + } + } + }, + "reduction": { + "Reduce": [ + 1 + ] + }, + "summary_type": { + "Sketch": "Kll" + } + } + } + } + }, + { + "guarantee": null, + "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 + } + } + } + }, + { + "guarantee": null, + "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 + } + } + ] + } + } + } + }, + { + "guarantee": null, + "id": 10, + "lifetime": { + "OneEvaluation": "Memory" + }, + "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, + 5 + ], + "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..fad6fd2a5 --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/sql-rollup-quantile-same-window-raw-retained.json @@ -0,0 +1,1144 @@ +{ + "accuracy_guarantees": "enforced", + "materialized_views": [], + "materialized_views_error": "the executor cannot compile the plan's query run: invalid DAG: node 2: 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": "rank", + "sketches": [ + "Kll" + ], + "summary": "accepted rank (Kll)" + } + ], + "cost": { + "cost_per_second": 2.9988396463e-10, + "cpu_core_seconds_per_second": 0.0000266671666667, + "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": 3.7480000184e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 3.33333333333e-6, + "detail": "time range 300s: keep 200000 of 200000 rows; x 0.0167/s; holds 48 bytes for 0.200 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "2": { + "cost_per_second": 3.7518339446e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 3.33333333333e-6, + "detail": "build Kll into 10000 states: 200000 rows x depth 1; x 0.0167/s; holds 10000000 bytes for 0.200 ms", + "multiplier": 1, + "operator": "SummaryAgg", + "timing": "query_time" + }, + "3": { + "cost_per_second": 1.874e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-7, + "detail": "estimate 10000 groups x 1; x 0.0167/s", + "multiplier": 1, + "operator": "SummaryEstimate", + "timing": "query_time" + }, + "4": { + "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" + }, + "5": { + "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" + }, + "6": { + "cost_per_second": 1.87400191697e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-7, + "detail": "merge 10000 states into 10; x 0.0167/s; holds 10000 bytes for 0.010 ms", + "multiplier": 1, + "operator": "SummaryMerge", + "timing": "query_time" + }, + "7": { + "cost_per_second": 1.874e-15, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-10, + "detail": "estimate 10 groups x 1; x 0.0167/s", + "multiplier": 1, + "operator": "SummaryEstimate", + "timing": "query_time" + }, + "8": { + "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" + }, + "9": { + "cost_per_second": 1.87400004601e-15, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-10, + "detail": "operator: pass 10 rows; x 0.0167/s; holds 240 bytes for 0.000 ms", + "multiplier": 1, + "operator": "Project", + "timing": "query_time" + } + }, + "source": "analytical-cost-v2 (illustrative statistics)", + "usage": { + "average_memory_bytes": 33.3361013773, + "cpu_ops_per_second": 10667.1666667, + "disk_bytes": 9600000, + "peak_cpu_cores": 2, + "peak_memory_bytes": 10010440, + "scanned_bytes_per_second": 160000.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": "SummaryState", + "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": { + "Sketch": "Kll" + }, + "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": "job", + "nullable": true + }, + { + "dtype": { + "Plain": "utf8" + }, + "name": "host", + "nullable": true + }, + { + "dtype": { + "Plain": "float64" + }, + "name": "quantile", + "nullable": true + } + ], + "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": "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": 4, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 6, + "data_state": { + "primitive": "SummaryState", + "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": { + "Sketch": "Kll" + }, + "name": "state", + "nullable": false + } + ], + "time_index": null, + "unique_keys": [ + [ + 0, + 1 + ] + ] + }, + "producer": 2, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 7, + "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": 6, + "role": "Input", + "window": "NotApplicable" + }, + { + "consumer": 8, + "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": 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": "approx_percentile_cont(data.value,Float64(0.9))", + "nullable": true + } + ], + "time_index": null, + "unique_keys": [ + [ + 0 + ] + ] + }, + "producer": 8, + "role": "Input", + "window": "NotApplicable" + } + ], + "nodes": [ + { + "guarantee": null, + "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 + }, + { + "guarantee": null, + "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 + } + } + } + } + }, + { + "guarantee": null, + "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": { + "Sketch": "Kll" + }, + "name": "state", + "nullable": false + } + ], + "time_index": null, + "unique_keys": [ + [ + 0, + 1 + ] + ] + }, + "output_state": { + "primitive": "SummaryState", + "timing": "query_time" + }, + "parameters": { + "Kll": { + "k": 1404 + } + }, + "payload": { + "ASAP": { + "SummaryAgg": { + "child": 1, + "filter": null, + "input": { + "item": null, + "weight": { + "Column": { + "Named": "value" + } + } + }, + "reduction": { + "Reduce": [ + 1, + 2 + ] + }, + "summary_type": { + "Sketch": "Kll" + } + } + } + } + }, + { + "guarantee": null, + "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": "quantile", + "nullable": true + } + ], + "time_index": null, + "unique_keys": [ + [ + 0, + 1 + ] + ] + }, + "output_state": { + "primitive": "Raw", + "timing": "query_time" + }, + "payload": { + "ASAP": { + "SummaryEstimate": { + "query": { + "Quantile": { + "q": 0.9 + } + }, + "summary_input": 2 + } + } + } + }, + { + "guarantee": null, + "id": 4, + "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": "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": { + "Project": { + "child": 3, + "cols": [ + { + "alias": "job", + "expr": { + "Column": 0 + } + }, + { + "alias": "host", + "expr": { + "Column": 1 + } + }, + { + "alias": "approx_percentile_cont(data.value,Float64(0.9))", + "expr": { + "Column": 2 + } + } + ] + } + } + } + }, + { + "guarantee": null, + "id": 5, + "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": 4, + "cols": [ + { + "alias": null, + "expr": { + "Column": 0 + } + }, + { + "alias": null, + "expr": { + "Column": 1 + } + }, + { + "alias": "value", + "expr": { + "Column": 2 + } + } + ] + } + } + } + }, + { + "guarantee": null, + "id": 6, + "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": 1404 + } + }, + "payload": { + "ASAP": { + "SummaryMerge": { + "children": [ + 2 + ], + "group_by": [ + 0 + ] + } + } + } + }, + { + "guarantee": null, + "id": 7, + "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": 6 + } + } + } + }, + { + "guarantee": null, + "id": 8, + "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": 7, + "cols": [ + { + "alias": "job", + "expr": { + "Column": 0 + } + }, + { + "alias": "approx_percentile_cont(data.value,Float64(0.9))", + "expr": { + "Column": 1 + } + } + ] + } + } + } + }, + { + "guarantee": null, + "id": 9, + "lifetime": { + "OneEvaluation": "Memory" + }, + "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": 8, + "cols": [ + { + "alias": null, + "expr": { + "Column": 0 + } + }, + { + "alias": "value", + "expr": { + "Column": 1 + } + } + ] + } + } + } + } + ], + "roots": [ + 9, + 5 + ], + "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..48174b3a3 --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/stddev-nested-labels-raw-retained.json @@ -0,0 +1,793 @@ +{ + "accuracy_guarantees": "enforced", + "materialized_views": [], + "materialized_views_error": "the executor cannot compile the plan's query run: invalid DAG: node 5: invalid DAG: aggregate intent has no native implementation", + "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": 3.78551223703e-11, + "cpu_core_seconds_per_second": 3.36666666667e-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", + "multiplier": 1, + "operator": "Scan", + "timing": "query_time" + }, + "1": { + "cost_per_second": 1.8740000092e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-7, + "detail": "time range 15s: keep 10000 of 10000 rows; x 0.0167/s; holds 48 bytes for 0.010 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "2": { + "cost_per_second": 3.74800015336e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 3.33333333333e-7, + "detail": "hash aggregate 10000 rows into 10 groups; x 0.0167/s; holds 400 bytes for 0.020 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": 1.87400001227e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-7, + "detail": "time range 15s: keep 10000 of 10000 rows; x 0.0167/s; holds 64 bytes for 0.010 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "5": { + "cost_per_second": 5.62232205135e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 5e-7, + "detail": "hash aggregate 10000 rows into 10000 groups; x 0.0167/s; holds 560000 bytes for 0.030 ms", + "multiplier": 1, + "operator": "Aggregate", + "timing": "query_time" + } + }, + "source": "analytical-cost-v2 (illustrative statistics)", + "usage": { + "average_memory_bytes": 0.280277333333, + "cpu_ops_per_second": 1500.0, + "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": [ + { + "guarantee": null, + "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 + }, + { + "guarantee": null, + "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 + } + } + } + } + }, + { + "guarantee": null, + "id": 2, + "lifetime": "None", + "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 + ] + } + } + } + } + }, + { + "guarantee": null, + "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 + }, + { + "guarantee": null, + "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 + } + } + } + } + }, + { + "guarantee": null, + "id": 5, + "lifetime": "None", + "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..31e449ff5 --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/sum-5m-avg-10m-over-time-raw-retained.json @@ -0,0 +1,701 @@ +{ + "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": 6.16966507412e-10, + "cpu_core_seconds_per_second": 0.0000548333333333, + "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": 7.49600002454e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 6.66666666667e-6, + "detail": "time range 600s: keep 400000 of 400000 rows; x 0.0167/s; holds 32 bytes for 0.400 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "2": { + "cost_per_second": 1.49926134311e-10, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 0.0000133333333333, + "detail": "hash aggregate 400000 rows into 10000 groups; x 0.0167/s; holds 400000 bytes for 0.800 ms", + "multiplier": 1, + "operator": "Aggregate", + "timing": "query_time" + }, + "3": { + "cost_per_second": 3.74800001227e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 3.33333333333e-6, + "detail": "time range 300s: keep 200000 of 400000 rows; x 0.0167/s; holds 32 bytes for 0.200 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "4": { + "cost_per_second": 3.7482147009e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 3.33333333333e-6, + "detail": "build exact Sum accumulator into 10000 states: 200000 rows x depth 1; x 0.0167/s; holds 560000 bytes for 0.200 ms", + "multiplier": 1, + "operator": "SummaryAgg", + "timing": "query_time" + }, + "5": { + "cost_per_second": 1.874e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-7, + "detail": "finalize 10000 accumulators; x 0.0167/s", + "multiplier": 1, + "operator": "FinalizeExactAccumulator", + "timing": "query_time" + } + }, + "source": "analytical-cost-v2 (illustrative statistics)", + "usage": { + "average_memory_bytes": 365.60032, + "cpu_ops_per_second": 33500.0, + "disk_bytes": 12800000, + "peak_cpu_cores": 2, + "peak_memory_bytes": 13760064, + "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" + }, + { + "consumer": 5, + "data_state": { + "primitive": "SummaryState", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "ExactAggregate": [ + "Sum", + "Sum" + ] + }, + "name": "state", + "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": [ + { + "guarantee": null, + "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 + }, + { + "guarantee": null, + "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 + } + } + } + } + }, + { + "guarantee": null, + "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" + } + } + } + }, + { + "guarantee": null, + "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 + } + } + } + } + }, + { + "guarantee": null, + "id": 4, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "ExactAggregate": [ + "Sum", + "Sum" + ] + }, + "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": 3, + "filter": null, + "input": { + "item": null, + "weight": { + "Column": "SampleValue" + } + }, + "reduction": "PerEntity", + "summary_type": { + "ExactAggregate": [ + "Sum", + "Sum" + ] + } + } + } + } + }, + { + "guarantee": null, + "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": { + "ASAP": { + "FinalizeExactAccumulator": { + "child": 4 + } + } + } + } + ], + "roots": [ + 5, + 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..3b4252f2f --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/sum-avg-over-time-5m-raw-retained.json @@ -0,0 +1,967 @@ +{ + "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.77380831785e-10, + "cpu_core_seconds_per_second": 0.0000246666666667, + "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": 3.75045372454e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 3.33333333333e-6, + "detail": "time range 300s: keep 200000 of 200000 rows; x 0.0167/s; holds 6400000 bytes for 0.200 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "2": { + "cost_per_second": 3.7482147009e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 3.33333333333e-6, + "detail": "build exact Count accumulator into 10000 states: 200000 rows x depth 1; x 0.0167/s; holds 560000 bytes for 0.200 ms", + "multiplier": 1, + "operator": "SummaryAgg", + "timing": "query_time" + }, + "3": { + "cost_per_second": 1.874e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-7, + "detail": "finalize 10000 accumulators; x 0.0167/s", + "multiplier": 1, + "operator": "FinalizeExactAccumulator", + "timing": "query_time" + }, + "4": { + "cost_per_second": 3.7482147009e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 3.33333333333e-6, + "detail": "build exact Sum accumulator into 10000 states: 200000 rows x depth 1; x 0.0167/s; holds 560000 bytes for 0.200 ms", + "multiplier": 1, + "operator": "SummaryAgg", + "timing": "query_time" + }, + "5": { + "cost_per_second": 1.874e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-7, + "detail": "finalize 10000 accumulators; x 0.0167/s", + "multiplier": 1, + "operator": "FinalizeExactAccumulator", + "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": "BinaryOp", + "timing": "query_time" + }, + "7": { + "cost_per_second": 1.874e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-7, + "detail": "finalize 10000 accumulators; x 0.0167/s", + "multiplier": 1, + "operator": "FinalizeExactAccumulator", + "timing": "query_time" + } + }, + "source": "analytical-cost-v2 (illustrative statistics)", + "usage": { + "average_memory_bytes": 25.06712, + "cpu_ops_per_second": 14000.0, + "disk_bytes": 6400000, + "peak_cpu_cores": 2, + "peak_memory_bytes": 7520064, + "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": [ + "Count", + "Count" + ] + }, + "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": 1, + "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": { + "ExactAggregate": [ + "Sum", + "Sum" + ] + }, + "name": "state", + "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": "Left", + "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": 3, + "role": "Right", + "window": "NotApplicable" + }, + { + "consumer": 7, + "data_state": { + "primitive": "SummaryState", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "ExactAggregate": [ + "Sum", + "Sum" + ] + }, + "name": "state", + "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": [ + { + "guarantee": null, + "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 + }, + { + "guarantee": null, + "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 + } + } + } + } + }, + { + "guarantee": null, + "id": 2, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "ExactAggregate": [ + "Count", + "Count" + ] + }, + "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": [ + "Count", + "Count" + ] + } + } + } + } + }, + { + "guarantee": null, + "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 + } + } + } + }, + { + "guarantee": null, + "id": 4, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "ExactAggregate": [ + "Sum", + "Sum" + ] + }, + "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": [ + "Sum", + "Sum" + ] + } + } + } + } + }, + { + "guarantee": null, + "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": { + "ASAP": { + "FinalizeExactAccumulator": { + "child": 4 + } + } + } + }, + { + "guarantee": null, + "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": { + "BinaryOp": { + "lhs": 5, + "operator": { + "checked_finite_division": true, + "checked_relative_division": false, + "kind": { + "Arithmetic": "Div" + }, + "vector_match": null + }, + "return_bool": false, + "rhs": 3 + } + } + } + }, + { + "guarantee": null, + "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": { + "ASAP": { + "FinalizeExactAccumulator": { + "child": 4 + } + } + } + } + ], + "roots": [ + 7, + 6 + ], + "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..1f4b661a8 --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/sum-over-time-two-intervals-raw-retained.json @@ -0,0 +1,904 @@ +{ + "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": 3.27578206706e-10, + "cpu_core_seconds_per_second": 0.0000291333333333, + "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.49920000491e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.33333333333e-6, + "detail": "time range 600s: keep 400000 of 400000 rows; x 0.0033/s; holds 32 bytes for 0.400 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "2": { + "cost_per_second": 1.49928588036e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.33333333333e-6, + "detail": "build exact Sum accumulator into 10000 states: 400000 rows x depth 1; x 0.0033/s; holds 560000 bytes for 0.400 ms", + "multiplier": 1, + "operator": "SummaryAgg", + "timing": "query_time" + }, + "3": { + "cost_per_second": 3.748e-13, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 3.33333333333e-8, + "detail": "finalize 10000 accumulators; x 0.0033/s", + "multiplier": 1, + "operator": "FinalizeExactAccumulator", + "timing": "query_time" + }, + "4": { + "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" + }, + "5": { + "cost_per_second": 3.74800001227e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 3.33333333333e-6, + "detail": "time range 300s: keep 200000 of 200000 rows; x 0.0167/s; holds 32 bytes for 0.200 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "6": { + "cost_per_second": 3.7482147009e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 3.33333333333e-6, + "detail": "build exact Sum accumulator into 10000 states: 200000 rows x depth 1; x 0.0167/s; holds 560000 bytes for 0.200 ms", + "multiplier": 1, + "operator": "SummaryAgg", + "timing": "query_time" + }, + "7": { + "cost_per_second": 1.874e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-7, + "detail": "finalize 10000 accumulators; x 0.0167/s", + "multiplier": 1, + "operator": "FinalizeExactAccumulator", + "timing": "query_time" + } + }, + "source": "analytical-cost-v2 (illustrative statistics)", + "usage": { + "average_memory_bytes": 2.61410986667, + "cpu_ops_per_second": 14200.0, + "disk_bytes": 12800000, + "peak_cpu_cores": 2, + "peak_memory_bytes": 1120128, + "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": 3, + "data_state": { + "primitive": "SummaryState", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "ExactAggregate": [ + "Sum", + "Sum" + ] + }, + "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": 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": "SummaryState", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "ExactAggregate": [ + "Sum", + "Sum" + ] + }, + "name": "state", + "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": [ + { + "guarantee": null, + "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 + }, + { + "guarantee": null, + "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 + } + } + } + } + }, + { + "guarantee": null, + "id": 2, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "ExactAggregate": [ + "Sum", + "Sum" + ] + }, + "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": [ + "Sum", + "Sum" + ] + } + } + } + } + }, + { + "guarantee": null, + "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 + } + } + } + }, + { + "guarantee": null, + "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": 600000 + }, + { + "guarantee": null, + "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": "range", + "range": { + "nanos": 0, + "secs": 300 + } + } + } + } + }, + { + "guarantee": null, + "id": 6, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "ExactAggregate": [ + "Sum", + "Sum" + ] + }, + "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": 5, + "filter": null, + "input": { + "item": null, + "weight": { + "Column": "SampleValue" + } + }, + "reduction": "PerEntity", + "summary_type": { + "ExactAggregate": [ + "Sum", + "Sum" + ] + } + } + } + } + }, + { + "guarantee": null, + "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": { + "ASAP": { + "FinalizeExactAccumulator": { + "child": 6 + } + } + } + } + ], + "roots": [ + 3, + 7 + ], + "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..d6c99e680 --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/topk-5-and-10-accuracy-raw-retained.json @@ -0,0 +1,578 @@ +{ + "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": 3.59844698355e-11, + "cpu_core_seconds_per_second": 3.20025e-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": 1.87400000613e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-7, + "detail": "time range 15s: keep 10000 of 10000 rows; x 0.0167/s; holds 32 bytes for 0.010 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.746694418667, + "cpu_ops_per_second": 2666.91666667, + "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": [ + { + "guarantee": null, + "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 + }, + { + "guarantee": null, + "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 + } + } + } + } + }, + { + "guarantee": null, + "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": [] + } + } + } + }, + { + "guarantee": null, + "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": [] + } + } + } + }, + { + "guarantee": null, + "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..d6c99e680 --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/topk-5-and-10-raw-retained.json @@ -0,0 +1,578 @@ +{ + "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": 3.59844698355e-11, + "cpu_core_seconds_per_second": 3.20025e-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": 1.87400000613e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-7, + "detail": "time range 15s: keep 10000 of 10000 rows; x 0.0167/s; holds 32 bytes for 0.010 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.746694418667, + "cpu_ops_per_second": 2666.91666667, + "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": [ + { + "guarantee": null, + "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 + }, + { + "guarantee": null, + "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 + } + } + } + } + }, + { + "guarantee": null, + "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": [] + } + } + } + }, + { + "guarantee": null, + "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": [] + } + } + } + }, + { + "guarantee": null, + "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..d87c9cb2c --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/topk-by-job-and-global-raw-retained.json @@ -0,0 +1,950 @@ +{ + "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": 6.74761949128e-11, + "cpu_core_seconds_per_second": 6.001e-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": 1.8740000092e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-7, + "detail": "time range 15s: keep 10000 of 10000 rows; x 0.0167/s; holds 48 bytes for 0.010 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": 1.87400000613e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-7, + "detail": "time range 15s: keep 10000 of 10000 rows; x 0.0167/s; holds 32 bytes for 0.010 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.826748845333, + "cpu_ops_per_second": 4667.66666667, + "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": [ + { + "guarantee": null, + "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 + }, + { + "guarantee": null, + "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 + } + } + } + } + }, + { + "guarantee": null, + "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 + ] + } + } + } + }, + { + "guarantee": null, + "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 + ] + } + } + } + }, + { + "guarantee": null, + "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 + }, + { + "guarantee": null, + "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 + } + } + } + } + }, + { + "guarantee": null, + "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": { + "Sort": { + "child": 5, + "keys": [ + { + "ascending": false, + "expr": { + "Column": 1 + }, + "nulls_first": false + } + ], + "partition_by": [] + } + } + } + }, + { + "guarantee": null, + "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..57e9b2fc2 --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/topk-rate-counter-raw-retained.json @@ -0,0 +1,685 @@ +{ + "accuracy_guarantees": "enforced", + "materialized_views": [], + "materialized_views_error": "the executor cannot compile the plan's query run: invalid DAG: node 4: invalid DAG: aggregate output names differ from measures", + "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": 2.36126350386e-10, + "cpu_core_seconds_per_second": 0.0000210000166667, + "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": 3.74800001227e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 3.33333333333e-6, + "detail": "time range 300s: keep 200000 of 200000 rows; x 0.0167/s; holds 32 bytes for 0.200 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "2": { + "cost_per_second": 3.7482147009e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 3.33333333333e-6, + "detail": "build exact Rate accumulator into 10000 states: 200000 rows x depth 1; x 0.0167/s; holds 560000 bytes for 0.200 ms", + "multiplier": 1, + "operator": "SummaryAgg", + "timing": "query_time" + }, + "3": { + "cost_per_second": 1.874e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-7, + "detail": "finalize 10000 accumulators; x 0.0167/s", + "multiplier": 1, + "operator": "FinalizeExactAccumulator", + "timing": "query_time" + }, + "4": { + "cost_per_second": 1.87401533885e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-7, + "detail": "hash aggregate 10000 rows into 1 groups; x 0.0167/s; holds 80016 bytes for 0.010 ms", + "multiplier": 1, + "operator": "Aggregate", + "timing": "query_time" + }, + "5": { + "cost_per_second": 1.8740000046e-16, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-11, + "detail": "hash aggregate 1 rows into 1 groups; x 0.0167/s; holds 24 bytes for 0.000 ms", + "multiplier": 1, + "operator": "Aggregate", + "timing": "query_time" + } + }, + "source": "analytical-cost-v2 (illustrative statistics)", + "usage": { + "average_memory_bytes": 1.88055733373, + "cpu_ops_per_second": 10333.35, + "disk_bytes": 6400000, + "peak_cpu_cores": 2, + "peak_memory_bytes": 640104, + "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": [ + { + "guarantee": null, + "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 + }, + { + "guarantee": null, + "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 + } + } + } + } + }, + { + "guarantee": null, + "id": 2, + "lifetime": "None", + "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" + ] + } + } + } + } + }, + { + "guarantee": null, + "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 + } + } + } + }, + { + "guarantee": null, + "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": [] + } + } + } + } + }, + { + "guarantee": null, + "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..f810ea612 --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/topk-sum-count-over-time-accuracy-raw-retained.json @@ -0,0 +1,921 @@ +{ + "accuracy_guarantees": "enforced", + "materialized_views": [], + "materialized_views_error": "the executor cannot compile the plan's query run: invalid DAG: node 4: invalid DAG: aggregate output names differ from measures", + "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.77380862456e-10, + "cpu_core_seconds_per_second": 0.0000246666666667, + "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": 3.75045372454e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 3.33333333333e-6, + "detail": "time range 300s: keep 200000 of 200000 rows; x 0.0167/s; holds 6400000 bytes for 0.200 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "2": { + "cost_per_second": 3.7482147009e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 3.33333333333e-6, + "detail": "build exact Count accumulator into 10000 states: 200000 rows x depth 1; x 0.0167/s; holds 560000 bytes for 0.200 ms", + "multiplier": 1, + "operator": "SummaryAgg", + "timing": "query_time" + }, + "3": { + "cost_per_second": 1.874e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-7, + "detail": "finalize 10000 accumulators; x 0.0167/s", + "multiplier": 1, + "operator": "FinalizeExactAccumulator", + "timing": "query_time" + }, + "4": { + "cost_per_second": 1.87401533885e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-7, + "detail": "hash aggregate 10000 rows into 1 groups; x 0.0167/s; holds 80016 bytes for 0.010 ms", + "multiplier": 1, + "operator": "Aggregate", + "timing": "query_time" + }, + "5": { + "cost_per_second": 3.7482147009e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 3.33333333333e-6, + "detail": "build exact Sum accumulator into 10000 states: 200000 rows x depth 1; x 0.0167/s; holds 560000 bytes for 0.200 ms", + "multiplier": 1, + "operator": "SummaryAgg", + "timing": "query_time" + }, + "6": { + "cost_per_second": 1.874e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-7, + "detail": "finalize 10000 accumulators; x 0.0167/s", + "multiplier": 1, + "operator": "FinalizeExactAccumulator", + "timing": "query_time" + }, + "7": { + "cost_per_second": 1.87401533885e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-7, + "detail": "hash aggregate 10000 rows into 1 groups; x 0.0167/s; holds 80016 bytes for 0.010 ms", + "multiplier": 1, + "operator": "Aggregate", + "timing": "query_time" + } + }, + "source": "analytical-cost-v2 (illustrative statistics)", + "usage": { + "average_memory_bytes": 25.0937866667, + "cpu_ops_per_second": 14000.0, + "disk_bytes": 6400000, + "peak_cpu_cores": 2, + "peak_memory_bytes": 7680064, + "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": [ + "Count", + "Count" + ] + }, + "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": "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": 6, + "data_state": { + "primitive": "SummaryState", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "ExactAggregate": [ + "Sum", + "Sum" + ] + }, + "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": "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": [ + { + "guarantee": null, + "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 + }, + { + "guarantee": null, + "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 + } + } + } + } + }, + { + "guarantee": null, + "id": 2, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "ExactAggregate": [ + "Count", + "Count" + ] + }, + "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": [ + "Count", + "Count" + ] + } + } + } + } + }, + { + "guarantee": null, + "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 + } + } + } + }, + { + "guarantee": null, + "id": 4, + "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": 3, + "filters": [], + "having": null, + "measures": [ + { + "k": 5, + "kind": "top_k" + } + ], + "output_names": [], + "reduction": { + "Reduce": [] + } + } + } + } + }, + { + "guarantee": null, + "id": 5, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "ExactAggregate": [ + "Sum", + "Sum" + ] + }, + "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": [ + "Sum", + "Sum" + ] + } + } + } + } + }, + { + "guarantee": null, + "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": { + "ASAP": { + "FinalizeExactAccumulator": { + "child": 5 + } + } + } + }, + { + "guarantee": null, + "id": 7, + "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": 6, + "filters": [], + "having": null, + "measures": [ + { + "k": 5, + "kind": "top_k" + } + ], + "output_names": [], + "reduction": { + "Reduce": [] + } + } + } + } + } + ], + "roots": [ + 7, + 4 + ], + "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..f810ea612 --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/topk-sum-count-over-time-raw-retained.json @@ -0,0 +1,921 @@ +{ + "accuracy_guarantees": "enforced", + "materialized_views": [], + "materialized_views_error": "the executor cannot compile the plan's query run: invalid DAG: node 4: invalid DAG: aggregate output names differ from measures", + "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.77380862456e-10, + "cpu_core_seconds_per_second": 0.0000246666666667, + "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": 3.75045372454e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 3.33333333333e-6, + "detail": "time range 300s: keep 200000 of 200000 rows; x 0.0167/s; holds 6400000 bytes for 0.200 ms", + "multiplier": 1, + "operator": "TimeRange", + "timing": "query_time" + }, + "2": { + "cost_per_second": 3.7482147009e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 3.33333333333e-6, + "detail": "build exact Count accumulator into 10000 states: 200000 rows x depth 1; x 0.0167/s; holds 560000 bytes for 0.200 ms", + "multiplier": 1, + "operator": "SummaryAgg", + "timing": "query_time" + }, + "3": { + "cost_per_second": 1.874e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-7, + "detail": "finalize 10000 accumulators; x 0.0167/s", + "multiplier": 1, + "operator": "FinalizeExactAccumulator", + "timing": "query_time" + }, + "4": { + "cost_per_second": 1.87401533885e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-7, + "detail": "hash aggregate 10000 rows into 1 groups; x 0.0167/s; holds 80016 bytes for 0.010 ms", + "multiplier": 1, + "operator": "Aggregate", + "timing": "query_time" + }, + "5": { + "cost_per_second": 3.7482147009e-11, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 3.33333333333e-6, + "detail": "build exact Sum accumulator into 10000 states: 200000 rows x depth 1; x 0.0167/s; holds 560000 bytes for 0.200 ms", + "multiplier": 1, + "operator": "SummaryAgg", + "timing": "query_time" + }, + "6": { + "cost_per_second": 1.874e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-7, + "detail": "finalize 10000 accumulators; x 0.0167/s", + "multiplier": 1, + "operator": "FinalizeExactAccumulator", + "timing": "query_time" + }, + "7": { + "cost_per_second": 1.87401533885e-12, + "cost_source": "analytical", + "cpu_core_seconds_per_second": 1.66666666667e-7, + "detail": "hash aggregate 10000 rows into 1 groups; x 0.0167/s; holds 80016 bytes for 0.010 ms", + "multiplier": 1, + "operator": "Aggregate", + "timing": "query_time" + } + }, + "source": "analytical-cost-v2 (illustrative statistics)", + "usage": { + "average_memory_bytes": 25.0937866667, + "cpu_ops_per_second": 14000.0, + "disk_bytes": 6400000, + "peak_cpu_cores": 2, + "peak_memory_bytes": 7680064, + "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": [ + "Count", + "Count" + ] + }, + "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": "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": 6, + "data_state": { + "primitive": "SummaryState", + "timing": "query_time" + }, + "grouping": "NotApplicable", + "intermediate_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "ExactAggregate": [ + "Sum", + "Sum" + ] + }, + "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": "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": [ + { + "guarantee": null, + "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 + }, + { + "guarantee": null, + "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 + } + } + } + } + }, + { + "guarantee": null, + "id": 2, + "lifetime": { + "OneEvaluation": "Memory" + }, + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "ExactAggregate": [ + "Count", + "Count" + ] + }, + "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": [ + "Count", + "Count" + ] + } + } + } + } + }, + { + "guarantee": null, + "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 + } + } + } + }, + { + "guarantee": null, + "id": 4, + "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": 3, + "filters": [], + "having": null, + "measures": [ + { + "k": 5, + "kind": "top_k" + } + ], + "output_names": [], + "reduction": { + "Reduce": [] + } + } + } + } + }, + { + "guarantee": null, + "id": 5, + "lifetime": "None", + "output_schema": { + "closed": true, + "fields": [ + { + "dtype": { + "Plain": "timestamp" + }, + "name": "ts", + "nullable": false + }, + { + "dtype": { + "ExactAggregate": [ + "Sum", + "Sum" + ] + }, + "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": [ + "Sum", + "Sum" + ] + } + } + } + } + }, + { + "guarantee": null, + "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": { + "ASAP": { + "FinalizeExactAccumulator": { + "child": 5 + } + } + } + }, + { + "guarantee": null, + "id": 7, + "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": 6, + "filters": [], + "having": null, + "measures": [ + { + "k": 5, + "kind": "top_k" + } + ], + "output_names": [], + "reduction": { + "Reduce": [] + } + } + } + } + } + ], + "roots": [ + 7, + 4 + ], + "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-no-phase.json b/crates/devtools/tests/sketch_plan_snapshots/workloads/quantile-over-time-no-phase.json new file mode 100644 index 000000000..d5ae63f4c --- /dev/null +++ b/crates/devtools/tests/sketch_plan_snapshots/workloads/quantile-over-time-no-phase.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": 60000 + }, + "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": 60000 + }, + "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-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