State aggregates
This section includes functions used to measure the time spent in a relatively small number of states.
For these hyperfunctions, you need to install the TimescaleDB Toolkit PostgreSQL extension.
Notes on state_agg and timeline_agg
timeline_agg supports all hyperfunctions that operate on StateAggs, in addition to some additional functions that need a full state timeline.
All state_agg and timeline_agg hyperfunctions support both string (TEXT) and integer (BIGINT) states. You can’t mix different types of states within a single aggregate. Integer states are useful when the state value is a foreign key representing a row in another table that stores all possible states.
Hyperfunctions
State aggregates functions
| Hyperfunction type | Hyperfunction name | Toolkit | Experimental |
|---|---|---|---|
| heartbeat_agg() functions | |||
| Aggregate | heartbeat_agg() | ✅ | ✅ |
| Accessor | dead_ranges() | ✅ | ✅ |
| downtime() | ✅ | ✅ | |
| interpolate() | ✅ | ✅ | |
| interpolated_downtime() | ✅ | ✅ | |
| interpolated_uptime() | ✅ | ✅ | |
| live_at() | ✅ | ✅ | |
| live_ranges() | ✅ | ✅ | |
| uptime() | ✅ | ✅ | |
| Rollup | rollup() | ✅ | ✅ |
| state_agg() | timeline_agg() functions | ||
| Aggregate | state_agg(), timeline_agg() | ✅ | ✅ |
| Accessor | duration_in() | ✅ | ✅ |
| interpolated_duration_in() | ✅ | ✅ | |
| interpolated_state_periods() | ✅ | ✅ | |
| interpolated_state_timeline() | ✅ | ✅ | |
| into_values() | ✅ | ✅ | |
| rollup() | ✅ | ✅ | |
| state_periods() | ✅ | ✅ | |
| state_timeline() | ✅ | ✅ |
