num_changes()

    For more information about counter aggregation functions, see the hyperfunctions documentation.

    NameTypeDescription
    num_changesBIGINTThe number of times the value changed
    1. SELECT
    2. id,
    3. num_changes(summary)
    4. FROM (
    5. SELECT
    6. id,
    7. time_bucket('15 min'::interval, ts) AS bucket,
    8. counter_agg(ts, val) AS summary
    9. FROM foo
    10. GROUP BY id, time_bucket('15 min'::interval, ts)