Skip to content

Latest commit

 

History

History
53 lines (52 loc) · 1.32 KB

num_resets.md

File metadata and controls

53 lines (52 loc) · 1.32 KB
api_name excerpt topics api hyperfunction api_details
num_resets()
Get the number of counter resets from a counter aggregate
hyperfunctions
license type toolkit experimental version
community
function
true
false
experimental stable
0.2.0
1.3.0
family type aggregates
counters and gauges
accessor
counter_agg()
summary signatures parameters examples
Get the number of times the counter is reset.
language code
sql
num_resets( summary CounterSummary ) RETURNS BIGINT
required returns
name type description
summary
CounterSummary
A counter aggregate created using [`counter_agg`](#counter_agg)
column type description
num_resets
BIGINT
The number of resets within the counter aggregate
description command
Get the number of counter resets for each 15-minute counter aggregate.
code
SELECT id, bucket, num_resets(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