delta()
Calculate the change in a counter from a counter aggregate
Since 1.3.0
Get the change in a counter over a time period. This is the simple delta, computed by subtracting the first value from the last, after accounting for resets.
Samples
Section titled “Samples”Get the change in each counter over the entire time interval in table foo.
SELECT id, delta(summary)FROM ( SELECT id, counter_agg(ts, val) AS summary FROM foo GROUP BY id) tArguments
Section titled “Arguments”The syntax is:
delta( summary CounterSummary) RETURNS DOUBLE PRECISION| Name | Type | Default | Required | Description |
|---|---|---|---|---|
summary | CounterSummary | - | ✔ | A counter aggregate created using counter_agg |
Returns
Section titled “Returns”| Column | Type | Description |
|---|---|---|
| delta | DOUBLE PRECISION | The change in the counter over the bucketed interval |