into_values()

Returns the data accumulated in a state aggregate.

into_values (
    agg StateAgg
) RETURNS (TEXT, BIGINT)

warning

Experimental features could have bugs. They might not be backwards compatible, and could be removed in future releases. Use these features at your own risk, and do not use any experimental features in production.

Required arguments

NameTypeDescription
aggStateAggThe aggregate to display data for

Returns

ColumnTypeDescription
stateTEXTA state found in the StateAgg
durationBIGINTThe duration of time spent in that state

Sample usage

Create a state aggregate from the table states_test. The time column is named time, and the state column contains text values corresponding to different states of a system. Use into_values to display the data from the state aggregate:

SELECT state, duration FROM toolkit_experimental.into_values(
     (SELECT toolkit_experimental.state_agg(time, state) FROM states_test));

Example output:

state | duration
------+-----------
ERROR |   3000000
OK    | 106000000
START |  11000000

Found an issue on this page?

Report an issue!

Keywords

Related Content