Arguments
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
| agg | HeartbeatAgg | - | ✔ | A heartbeat aggregate to trim down |
| start | TimestampTz | - | The start of the trimmed range. If not provided, the returned heartbeat aggregate starts from the same time as the starting one | |
| duration | Interval | - | How long the resulting aggregate should cover. If not provided, the returned heartbeat aggregate ends at the same time as the starting one |
Returns
| Column | Type | Description |
|---|---|---|
| trim_to | heartbeat_agg | The trimmed aggregate |
Samples
Given a table calledliveness containing weekly heartbeat aggregates in column health with timestamp column date,
use this query to roll up several weeks and trim the result to an exact month: