counter_zero_time()

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.

2. counter_zero_time(

4. summary CounterSummary

6. ) 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

2. SELECT

4. id,

6. bucket,

8. counter_zero_time(summary)

10. FROM (

12. SELECT

14. id,

16. time_bucket('15 min'::interval, ts) AS bucket,

18. counter_agg(ts, val) AS summary

20. FROM foo

22. GROUP BY id, time_bucket('15 min'::interval, ts)

24. ) t