You can use the TimeSeries model to store, query, and analyze time series.
The TimeSeries model is in public preview in the China (Shanghai), China (Hangzhou), and China (Shenzhen) regions. During the public preview, you can use the TimeSeries model free of charge. To get started with the TimeSeries model, you can log on to the Tablestore console and click Create Public Preview Instance for TimeSeries Model to create a public preview instance for the TimeSeries model. For more information, see Create a public preview instance for the TimeSeries model.
After you create a public preview instance for the TimeSeries model, you can use the Tablestore console, CLI, or SDKs to get started with the TimeSeries model. For more information, see Use the Tablestore console, Use the Tablestore CLI, and Use Tablestore SDKs.
If you have questions, please join the Tablestore technical support group by searching for group ID 11789671 or 23307953 in DingTalk to contact us.
Tablestore is a multi-model data storage service that is developed by Alibaba Cloud. Tablestore can store large amounts of structured data and supports a variety of data models, including the TimeSeries model.
- Provides a unified-common modeling method for time series data, which eliminates the need to predefine table schemas.
- Allows metadata indexes to be automatically created for time series and supports time series retrieval based on composite conditions.
- Supports queries and aggregation by using SQL.
- Supports automatic scale-out of service capabilities, high-concurrency writes and queries, and low-cost storage of petabytes of data.
|Time series data||Time series data consists of multiple time series. Each time series is a set of data
points that are arranged in chronological order. In addition, some metadata is needed
to identify a time series. Therefore, time series data consists of metadata and data.
|Time series metadata||Time series metadata contains the identifier and properties of a time series. The identifier is used to uniquely identify a time series. The properties can be modified and can be used for time series retrieval.|
|Time series identifier||A time series identifier is used to uniquely identify a time series. In the TimeSeries model of Tablestore, a time series identifier consists of the following three parts: metric name, data source, and tag.|
|Metric name||The name of a physical quantity or metric for data in a time series, such as cpu or net, which indicates that the CPU usage or network usage is recorded in the time series.|
|Data source||The identifier of the data source for the time series. This parameter can be empty.|
|Tag||The tag of the time series. You can customize multiple key-value pairs of the string type.|
|Property||Properties are part of time series metadata and can be used to record some modifiable property information of a time series. However, the properties cannot be used as the identifier of a time series and cannot be used to uniquely identify a time series. The properties of a time series are multiple key-value pairs of the string type, which are similar to tags in the format. You can specify or update the properties of a time series to retrieve the time series by using the properties.|
|Data in a time series||A data point in a time series consists of the time when the data is generated and
the corresponding data value. If only one value is generated at each moment in a time
series, the single-value model is used. If multiple values are generated at each moment
in a time series, the multi-value model is used.
The TimeSeries model of Tablestore uses the multi-value model. You can specify multiple data values at one point in time. Each value corresponds to a column in the time series table, including the column name and column value. Column values support the following data types: Boolean, integer, floating-point, string, and binary.
In the TimeSeries model of Tablestore, a two-dimensional time series table is used to store time series data.
Each row represents the data at a point in time in a time series. The time series identifier and timestamp are the primary key columns of the row, and the data points of the time series under the timestamp are the data columns of the row. A row can contain multiple data columns. You do not need to predefine the schemas of the primary key columns and data columns. You only need to specify the names of the specific data columns when you write data to the time series table.
A time series table can store time series data of different metric types. In the following figure, the time series table stores data of the following two metric types: temperature and humidity.
In the figure, the measurement, data source, and tags parameters form a time series identifier. You can use an API operation to update the properties in the metadata of a time series. The properties can be used to retrieve the time series.
After data is written to a time series table, the system automatically extracts the metadata of the time series and automatically creates a metadata index. You can retrieve a time series based on the combination of the metric name, data source, and tags.
- Create and manage time series tables
You can use the Tablestore console, SDKs, or CLI to query all time series tables in an instance, create a time series table, query the configurations of a time series table, update the configurations of a time series table, and delete a time series table.
When you create a time series table or update the configurations of a time series table, you can specify the time to live (TTL) for the data in the time series table. After the TTL value is specified, the system automatically checks the difference between the current time and the timestamp of the time series data. If the difference exceeds the TTL value, the system automatically deletes the expired data.
- Read and write time series data
You can use the Tablestore console, SDKs, or CLI to write multiple rows of time series data to a time series table at the same time. After data is written to the time series table, you can specify a time series identifier to query the data in the time series within the specified time range.
- Retrieve time series
You can use the Tablestore console, SDKs, or CLI to retrieve time series in a time series table. You can use a composite condition that consists of multiple conditions to retrieve time series. For example, you can retrieve all time series in which the metric name is cpu, the tags contain a tag whose name is region and value is hangzhou, and the properties contain a property whose name is status and value is online. After the time series are retrieved, you can call an API operation to further query the data in the time series.
- Implement SQL query and analytics
Time series tables support queries by using SQL. In SQL, you can specify the metadata condition to filter time series and aggregate data based on the aggregation operations in different dimensions. For example, you can query the average value of the sample data from a batch of devices and aggregate second-level data into minute-level data.
In addition, you can query only the metadata of time series in SQL. This way, you can manage the metadata of time series by using SQL.
For more information, see Limits on the TimeSeries model.