This topic describes the sequence decomposition function that you can use to decompose business curves and highlight the information about the curve trends and periods.

ts_decompose

Function format:
select ts_decompose(x, y) 
The following table lists the parameters of the function.
Parameter Description Value
x The time sequence. The points in time along the horizontal axis are sorted in ascending order. Each point in time is a Unix timestamp. Unit: seconds.
y The sequence of the numeric values of the property under observation, corresponding to the specified points in time. N/A
Example
  • The query statement is as follows:
    * | select ts_decompose(stamp, value) from (select __time__ - __time__ % 60 as stamp, avg(v) as value from log GROUP BY stamp order by stamp)
  • Output resultOutput result
The following table lists the display items.
Display item Description
Horizontal axis unixtime The Unix timestamp of the data. Unit: seconds.
Vertical axis src The raw data.
trend The decomposed curve trend.
season The decomposed curve period.
residual The decomposed residual data.