The Time Series Database (TSDB) SQL query engine — also called the TSQL query engine or TSQL engine — supports SQL-like queries and time series data queries. It lets you query multiple metrics using JOIN operations.
This topic maps time series concepts to their SQL equivalents so you can use TSQL effectively if you have a relational database background.
How time series data maps to SQL
A time series in TSDB looks like this:

For definitions of metrics, tags, tag values, timestamps, and values in TSDB, see Terms.
The SQL relational model represents data as a two-dimensional table. The time series above maps to this relational 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 |
| ... |
Data model reference
| TSDB time series model | TSDB SQL relational model |
|---|---|
| Metric | Table |
| Timestamp | The timestamp column. Data type: TIMESTAMP |
| Value | The value column. Supported data types: DOUBLE, VARCHAR, and BOOLEAN |
| Tag key | The TagKey column. Data type: VARCHAR |
| Tag value | Each value in the TagKey column |
Limitations
The multi-value model is not supported.
Single table queries cannot return values from multiple fields.