num_resets()
The total number of times the counter is reset while calculating the CounterSummary.
2. num_resets(
4. summary CounterSummary
6. ) RETURNS BIGINT
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 |
|---|---|---|
| num_resets | BIGINT | The number of resets detected during the counter_agg call |
Sample usage
2. SELECT
4. id,
6. bucket,
8. num_resets(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
