Versions:
counter_zero_time() 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 time at which the counter value is predicted to have been zero based on the least squares fit line computed from the points in the CounterSummary.
counter_zero_time(
summary CounterSummary
) RETURNS TIMESTAMPTZ
For more information about counter aggregation functions, see the hyperfunctions documentation.
Required arguments
Name | Type | Description |
---|---|---|
summary | CounterSummary | The input CounterSummary from a counter_agg call |
Returns
Name | Type | Description |
---|---|---|
counter_zero_time | TIMESTAMPTZ | The time at which the counter value is predicted to have been zero based onthe least squares fit of the points input to the CounterSummary |
Sample usage
SELECT
id,
bucket,
counter_zero_time(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!