time_delta()

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

    NameTypeDescription
    time_deltaDOUBLE PRECISIONThe total duration in seconds between the first and last observed times in the CounterSummary
    1. SELECT
    2. id,
    3. time_delta(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)