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.

  1. irate_left(
  2. summary CounterSummary
  3. ) RETURNS DOUBLE PRECISION

Required arguments

NameTypeDescription
summaryCounterSummaryThe input CounterSummary from a counter_agg call

Returns

NameTypeDescription
irate_leftDOUBLE PRECISIONThe instantaneous rate computed from the left (earlier) side of the CounterSummary

Sample usage

  1. SELECT
  2. id,
  3. bucket,
  4. irate_left(summary)
  5. FROM (
  6. SELECT
  7. id,
  8. time_bucket('15 min'::interval, ts) AS bucket,
  9. counter_agg(ts, val) AS summary
  10. FROM foo
  11. GROUP BY id, time_bucket('15 min'::interval, ts)
  12. ) 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.

  1. irate_right(
  2. summary CounterSummary
  3. ) RETURNS DOUBLE PRECISION

Required arguments

NameTypeDescription
summaryCounterSummaryThe input CounterSummary from a counter_agg call

Returns

NameTypeDescription
irate_rightDOUBLE PRECISIONThe instantaneous rate computed from the right (later) side of the CounterSummary

Sample usage

  1. SELECT
  2. id,
  3. bucket,
  4. irate_right(summary)
  5. FROM (
  6. SELECT
  7. id,
  8. time_bucket('15 min'::interval, ts) AS bucket,
  9. counter_agg(ts, val) AS summary
  10. FROM foo
  11. GROUP BY id, time_bucket('15 min'::interval, ts)
  12. ) t