irate_left() and irate_right()

The instantaneous rate of change of the counter at the left (earlier) and right (later) side of the time range.

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

irate_left()

The instantaneous rate of change of the counter at the left (earlier) side of the time range. Essentially, the idelta_left divided by the duration between the first and second observed points in the CounterSummary. This can be especially useful for fast moving counters.

2. irate_left(

4. summary CounterSummary

6. ) RETURNS DOUBLE PRECISION

Required arguments

Name Type Description
summary CounterSummary The input CounterSummary from a counter_agg call

Returns

Name Type Description
irate_left DOUBLE PRECISION The instantaneous rate computed from the left (earlier) side of the CounterSummary

Sample usage

2. SELECT

4. id,

6. bucket,

8. irate_left(summary)

10. FROM (

12. SELECT

14. id,

16. time_bucket('15 min'::interval, ts) AS bucket,

18. counter_agg(ts, val) AS summary

20. FROM foo

22. GROUP BY id, time_bucket('15 min'::interval, ts)

24. ) t

irate_right()

The instantaneous rate of change of the counter at the right (later) side of the time range. Essentially, the idelta_right divided by the duration between the first and second observed points in the CounterSummary. This can be especially useful for fast moving counters.

2. irate_right(

4. summary CounterSummary

6. ) RETURNS DOUBLE PRECISION

Required arguments

Name Type Description
summary CounterSummary The input CounterSummary from a counter_agg call

Returns

Name Type Description
irate_right DOUBLE PRECISION The instantaneous rate computed from the right (later) side of the CounterSummary

Sample usage

2. SELECT

4. id,

6. bucket,

8. irate_right(summary)

10. FROM (

12. SELECT

14. id,

16. time_bucket('15 min'::interval, ts) AS bucket,

18. counter_agg(ts, val) AS summary

20. FROM foo

22. GROUP BY id, time_bucket('15 min'::interval, ts)

24. ) t