All Products
Search
Document Center

Terms

Last Updated: May 19, 2022

The Time Series Database (TSDB) SQL query engine supports SQL-like queries and time series data queries. The engine allows you to use TSQL to query multiple metrics based on JOIN operations. The TSDB SQL query engine is also known as the TSQL query engine or the TSQL engine.

This topic describes the relationship between time series data and relational data and the time series data models that are based on SQL relational models.

The following diagram shows a time series in a TSDB database. For information about metrics, tags, tag values, timestamps, and values in TSDB, see Terms.timeseries

An SQL relational model is a two-dimensional relational table. The preceding time series data can be organized into the following two-dimensional table.

Table:Temperature

timestamp

value

Floor

Room

DeviceID

1492158910

26

33

3302

7649501

1492158920

25.8

33

3302

7649501

1492158930

26.1

33

3302

7649501

1492158940

26.3

33

3302

7649501

1492158950

26.5

33

3302

7649501

...

Mapping between a time series data model and a relational model

TSDB time series data model

TSDB SQL relational model

Metric

Table.

Timestamp

The timestamp column in a table. The data type of the values in this column is TIMESTAMP.

Value

The value column in a table. The supported data types of the metric values in this column are DOUBLE, VARCHAR, and BOOLEAN. The multi-value model is not supported, and the values of multiple fields cannot be returned for single table queries.

Tag key

The TagKey column in a table. The data type of the values in this column is VARCHAR.

Tag value

Each value in the TagKey column.