gauge_agg()
warning
Experimental features could have bugs. They might not be backwards compatible, and could be removed in future releases. Use these features at your own risk, and do not use any experimental features in production.
Only DOUBLE PRECISION
values are accepted for the value
parameter. For gauge data stored as other numeric types, cast it to DOUBLE PRECISION
when using the function.
note
important
Bounds are required for extrapolation, but not for other accessor functions.
important
Create a gauge summary from time-series data that has a timestamp, ts
, and a gauge value, val
. Get the instantaneous rate of change from the last 2 time intervals using the irate_right
accessor:
WITH t as (
SELECT
time_bucket('1 day'::interval, ts) as dt,
gauge_agg(ts, val) AS gs
FROM foo
WHERE id = 'bar'
)
SELECT
dt,
irate_right(gs)