TimeSeries data type technical overview
The TimeSeries data type defines the structure for the time series data within a single column in the database.
The TimeSeries data type is a constructor data type that groups together a collection of ROW data type in time stamp order. A ROW data type consists of a group of named columns. The rows in a TimeSeries data type, called elements, each represent one or more data values for a specific time stamp. The elements are ordered by time stamp. The time stamp column must be the first column in the TimeSeries ROW data type and must be of type DATETIME YEAR TO FRACTION(5), even if your data does not have a scale of five fractional seconds. Time series provides a TSTAMP distinct type defined as DATETIME YEAR TO FRACTION(5) and the TSTAMP type may be used in place of the qualified DATATIME data type. Time stamps must be unique; multiple entries in a single TimeSeries cannot have the same time stamp.
The figure shows the ts_data table, which has two columns: the location_id column that identifies the source of the time series data, and the reads column that contains the time series data. The reads column has a data type of TimeSeries(meter_data). The TimeSeries(meter_data) data type has two columns: tstamp and value. The tstamp column, as the first column in a TimeSeries data type, has a data type of DATETIME YEAR TO FRACTION(5). For a regular time series such as the one in the illustration, the timestamp is actually replaced by the offset from the first element. The value column has a data type of DECIMAL. For each source of data, the reads column contains multiple rows of time series data, which are ordered by time stamp. All time series data for a particular source is in the same row of the table. Each value of the reads column in the ts_data table is a different time series instance.