with_bounds()
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
当前内容版权归 TimescaleDB 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 TimescaleDB .