Skip to content

compact_state_agg()

Aggregate state data into a state aggregate for further analysis

Early access 1.5.0

Aggregate a dataset containing state data into a state aggregate to track the time spent in each state.

Create a state aggregate to track the status of some devices.

SELECT toolkit_experimental.compact_state_agg(time, status) FROM devices;

The syntax is:

compact_state_agg(
ts TIMESTAMPTZ,
value {TEXT | BIGINT}
) RETURNS CompactStateAgg
NameTypeDefaultRequiredDescription
tsTIMESTAMPTZ-Timestamps associated with each state reading
valueTEXTBIGINT-
ColumnTypeDescription
aggCompactStateAggAn object storing the total time spent in each state