num_changes()
For more information about counter aggregation functions, see the hyperfunctions documentation.
Name | Type | Description |
---|---|---|
num_changes | BIGINT | The number of times the value changed |
SELECT
id,
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)