All Products
Document Center


Last Updated: Sep 16, 2020

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

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

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

Table: Temperature
Timestamp Value Floor Room Device ID
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. Currently, the multi-value data model is not supported and multiple field values 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 The values that correspond to the TagKey column.