Database Design
Last updated
Last updated
By default, the store creates a database and two tables: tssamples_metadata and tssamples_data. Metadata of the time series associated with the store is placed In tssamples_metadata, while the time series values are written in tssamples_data.
Structure of the time series metadata table (tssamples_metadata):
tag_set: The column is the primary key of the table and is of the JSONB type. The column is a set of attributes or tags (key-value pairs) identifying a time series. By default, the set contains only one tag, tsid, representing the address of the time series. However, by changing parameters from the Advanced category, you can add additional tags. For example, if you set the parameter Add Time Series Comment to Tag, a tsc tag will be added to the set containing a comment to the series.
server_uid: The column is of the TEXT type and contains a unique server identifier.
store_uid: The column is of the TEXT type and contains unique store identifier.
ts_uid: The column is of the TEXT type and contains unique time series identifier.
ts_path: The column is of the TEXT type and contains path to time series. The values of this column are indexed.
ts_comment: The column is of the TEXT type and contains comment for time series.
tag_set_id: The column is of the INTEGER type, is auto-incremental and contains unique numeric identifier for time series.
Structure of the time series data table (tssamples_data):
sample_time: The column is of the TIMESTAMP WITHOUT TIME ZONE type and contains measurement time. The values of this column are indexed.
tag_id: The column is of the INTEGER type and contains the link to the tag_set_id column from the tssamples_metadata table. The values of this column are indexed.
sample_value: The column is of the FLOAT8 type and contains the sample value.
sample_status: The column is of the INTEGER type and contains the sample status.
Below is an example of a database query that will return data for a 5-minute interval for time series with the paths MySeries.Temperature and MySeries.Pressure:
Note that the time of this query is in the UTC format.
tag_set [PK]
jsonb
server_uid
text
store_uid
text
ts_uid
text
ts_path
text
ts_comment
text
tag_set_id
integer
sample_time
timestamp without time zone
tag_id
integer
sample_value
double precision
sample_status
integer