Skip to content

Latest commit

 

History

History
54 lines (53 loc) · 1.43 KB

num_changes.md

File metadata and controls

54 lines (53 loc) · 1.43 KB
api_name excerpt topics api hyperfunction api_details
num_changes()
Get the number of times a counter changed 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 changed during the period summarized by the counter aggregate. Any change is counted, including resets to zero.
language code
sql
num_changes( summary CounterSummary ) RETURNS BIGINT
required returns
name type description
summary
CounterSummary
A counter summary created using [`counter_agg`](#counter_agg)
column type description
num_changes
BIGINT
The number of times the counter changed
description command
Get the number of times the counter changed over each 15-minute interval.
code
SELECT id, bucket, num_changes(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