Sequence decomposition function
Updated at:
Sequence decomposition functions break down a time series to highlight its trend and periodic components.
ts_decompose
Function format:
select ts_decompose(x, y) The parameters are as follows:
Parameter | Description | Value |
x | The time column, sorted in ascending order. | The format is a UNIX timestamp in seconds. |
y | The numeric value column that corresponds to a point in time. | - |
Example:
Analyzing queries
* | select ts_decompose(stamp, value) from (select'("__time__" - ("__time__" % 60))' as stamp, avg(v) as value from log GROUP BY stamp order by stamp)Outputs:

The following items are displayed:
Display item | Description | |
Horizontal axis | unixtime | The UNIX timestamp of the data in seconds. |
Vertical axis | src | Raw data. |
trend | The decomposed trend data. | |
season | The decomposed period data. | |
residual | The decomposed residual data. | |
Is this page helpful?