Time series aggregate functions perform computations on a set of time series data and interpret the results in terms of time. Conceptually, traditional functions that are time series enabled behave the same when they are operating on time series data and other data; for example, the times series AVERAGE function and a traditional AVERAGE function compute the average for each specified group. However, only time series aggregate functions have these characteristics:
- The specification of the groups: Time series aggregates are always grouped by time, and optionally by other columns (see GROUP BY TIME Clause). Traditional aggregates are not grouped by time.
- The resulting columns: Time series aggregates return system virtual columns which may or may not be selected by the user and included in further calculations or results. Traditional aggregates do not return any system virtual columns. See System Virtual Columns Returned by Time Series Aggregates.
- The composition of the result set: Time series aggregates are aware of expected groups in the desired time range. If there is no aggregate result for one or more of these expected groups, time series aggregates allow a user to specify how to handle empty result sets. Traditional aggregates are not aware of expected groups and therefore do not provide any mechanism for handling empty results. For more information, see Missing Value Imputation.
Time series functions cannot be combined with traditional aggregate, ordered analytic, or statistics functions:
- If a GROUP BY TIME clause is present, all aggregates are interpreted as time series aggregates. The presence of any functions not included in the time series aggregate group results in an error.
- If a GROUP BY clause is present, all functions are interpreted as traditional aggregate, ordered analytic, or statistics functions. The presence of any aggregates only valid for time series data results in an error.