interpolated_duration_in.
Arguments
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
| agg | StateAgg | - | ✔ | A state aggregate created with compact_state_agg |
| state | TEXT | BIGINT | - | ✔ | The state to query |
| start | TIMESTAMPTZ | - | If specified, only the time in the state after this time is returned | |
| interval | INTERVAL | - | If specified, only the time in the state from the start time to the end of the interval is returned |
Returns
| Column | Type | Description |
|---|---|---|
| duration_in | INTERVAL | The time spent in the given state. Displayed in days, hh:mm:ss, or a combination of the two |
Samples
Create a test table that tracks when a system switches betweenstarting, running, and error states. Query the
table for the time spent in the running state.
If you prefer to see the result in seconds, EXTRACT the epoch from the returned result.