Versions:
with_bounds() ToolkitTimescaleDB Toolkit functions are available under Timescale Community Edition. They are automatically included with Timescale Cloud. Click to learn more.
Toolkit
TimescaleDB Toolkit functions are available under Timescale Community Edition. They are automatically included with Timescale Cloud. Click to learn more.
A utility function to add bounds to an already-computed CounterSummary. The bounds represent the outer limits of the timestamps allowed for this CounterSummary as well as the edges of the range to extrapolate to in functions that allow it.
with_bounds(
summary CounterSummary,
bounds TSTZRANGE,
) RETURNS CounterSummary
For more information about counter aggregation functions, see the hyperfunctions documentation.
Required arguments
Name | Type | Description |
---|---|---|
summary | CounterSummary | The input CounterSummary |
bounds | TSTZRANGE | A range of timestamptz representing the largest and smallest allowed times in this CounterSummary |
Returns
Name | Type | Description |
---|---|---|
counter_agg | CounterSummary | A CounterSummary object that can be passed to accessor functions or other objects in the counter aggregate API |
Sample usage
SELECT
id,
bucket,
extrapolated_rate(
with_bounds(
summary,
time_bucket_range('15 min'::interval, bucket)
)
)
FROM (
SELECT
id,
time_bucket('15 min'::interval, ts) AS bucket,
counter_agg(ts, val) AS summary
FROM foo
GROUP BY id, time_bucket('15 min'::interval, ts)
) t
Found an issue on this page?
Report an issue!