counter_zero_time()
Calculate the time when the counter value is predicted to have been zero
Since 1.3.0
Calculate the time when the counter value is predicted to have been zero. This is the x-intercept of the linear fit between counter value and time.
Samples
Section titled “Samples”Estimate the time when the counter started
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)) tArguments
Section titled “Arguments”The syntax is:
counter_zero_time( summary CounterSummary) RETURNS TIMESTAMPTZ| Name | Type | Default | Required | Description |
|---|---|---|---|---|
summary | CounterSummary | - | ✔ | A counter aggregate created using counter_agg |
Returns
Section titled “Returns”| Column | Type | Description |
|---|---|---|
| counter_zero_time | TIMESTAMPTZ | The time when the counter value is predicted to have been zero |