interpolated_state_periods.
Samples
Create a state aggregate and list all periods corresponding to the stateOK.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Get the time periods corresponding to a given state from a state aggregate
interpolated_state_periods.
OK.
SELECT start_time, end_time FROM state_periods(
(SELECT state_agg(ts, state) FROM states_test),
'OK',
);
start_time | end_time
------------------------+------------------------
2020-01-01 00:00:11+00 | 2020-01-01 00:01:00+00
2020-01-01 00:01:03+00 | 2020-01-01 00:02:00+00
state_periods(
agg StateAgg,
state [TEXT | BIGINT]
) RETURNS (TIMESTAMPTZ, TIMESTAMPTZ)
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
| agg | StateAgg | - | ✔ | A state aggregate created using state_agg |
| state | TEXT | BIGINT | - | ✔ | The target state to get data for |
| Column | Type | Description |
|---|---|---|
| start_time | TIMESTAMPTZ | The time when the state started (inclusive) |
| end_time | TIMESTAMPTZ | The time when the state ended (exclusive) |