into_values()
Returns the data accumulated in a state aggregate.
into_values (
agg [StateAgg | TimelineAgg]
) RETURNS (TEXT, BIGINT)
into_int_values (
agg [StateAgg | TimelineAgg]
) RETURNS (INT, 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
Name | Type | Description |
---|---|---|
agg | StateAgg or TimelineAgg | The aggregate to display data for |
Returns
Column | Type | Description |
---|---|---|
state | TEXT | A state found in the StateAgg or TimelineAgg |
duration | BIGINT or INT | The 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
当前内容版权归 TimescaleDB 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 TimescaleDB .