Versions:
idelta_left() and idelta_right() 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.
The instantaneous change in the counter at the left (earlier) and right (later) side of the time range.
For more information about counter aggregation functions, see the hyperfunctions documentation.
idelta_left()
The instantaneous change in the counter at the left (earlier) side of the time range. Essentially, the first value subtracted from the second value seen in the time range (handling resets appropriately). This can be especially useful for fast moving counters.
idelta_left(
summary CounterSummary
) RETURNS DOUBLE PRECISION
Required arguments
Name | Type | Description |
---|---|---|
summary | CounterSummary | The input CounterSummary from a counter_agg call |
Returns
Name | Type | Description |
---|---|---|
idelta_left | DOUBLE PRECISION | The instantaneous delta computed from the left (earlier) side of the CounterSummary |
Sample usage
SELECT
id,
bucket,
idelta_left(summary)
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
idelta_right()
The instantaneous change in the counter at the right (later) side of the time range. Essentially, the penultimate value subtracted from the last value seen in the time range (handling resets appropriately). This can be especially useful for fast moving counters.
idelta_right(
summary CounterSummary
) RETURNS DOUBLE PRECISION
Required arguments
Name | Type | Description |
---|---|---|
summary | CounterSummary | The input CounterSummary from a counter_agg call |
Returns
Name | Type | Description |
---|---|---|
idelta_right | DOUBLE PRECISION | The instantaneous delta computed from the right (later) side of the CounterSummary |
Sample usage
SELECT
id,
bucket,
idelta_right(summary)
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!