rollup( sketch uddsketch ) RETURNS UddSketch
rollup( digest tdigest ) RETURNS tdigest
This combines multiple outputs from the
percentile_agg() function, or either
tdigest()). This is especially useful for
re-aggregation in a continuous aggregate. For example, bucketing by a larger
time_bucket(), or re-grouping on other dimensions included in
- For more information about percentile approximation algorithms, see advanced aggregation methods.
- For more information about percentile approximation functions, see the hyperfunctions documentation.
|The already constructed data structure from a previous |
|A UddSketch or tdigest object which may be passed to further APIs|
When you use the
UddSketch aggregates, the
function does not introduce additional errors compared to calculating the
estimator directly, however, using
tdigest can introduce
additional errors compared to calculating the estimator directly on the
Re-aggregate an hourly continuous aggregate into daily buckets, the usage with
tdigest is exactly the same:
CREATE MATERIALIZED VIEW foo_hourly WITH (timescaledb.continuous) AS SELECT time_bucket('1 h'::interval, ts) as bucket, percentile_agg(value) as pct_agg FROM foo GROUP BY 1; SELECT time_bucket('1 day'::interval, bucket) as bucket, approx_percentile(0.95, rollup(pct_agg)) as p95, approx_percentile(0.99, rollup(pct_agg)) as p99 FROM foo_hourly GROUP BY 1;
Found an issue on this page?Report an issue!