The TimeSeries model uses time series tables to store time series data. A single time series table supports high-concurrency writes and queries and storage of petabytes of data at low costs. This topic describes how to create and manage time series tables.
Usage notes
You can create a maximum of 64 tables in a single instance. The tables consist of data tables, secondary indexes, time series tables, Lastpoint indexes, and analytical stores. For more information about the limits, see Limits on the TimeSeries model.
NoteA time series table comprises two components: a time series metadata table and a time series data table. When the system calculates the total number of tables in an instance, it counts a time series table as two separate tables.
The TimeSeries model is supported in the following regions: China (Hangzhou), China (Shanghai), China (Beijing), China (Zhangjiakou), China (Ulanqab), China (Shenzhen), China (Chengdu), China (Hong Kong), Japan (Tokyo), Malaysia (Kuala Lumpur), Germany (Frankfurt), Indonesia (Jakarta), UK (London), US (Silicon Valley), US (Virginia), SAU (Riyadh - Partner Region), and Singapore.
You can specify custom time series identifiers and custom data fields as the primary key columns and use the Lastpoint index and analytical store features in the following regions: China (Hangzhou), China (Shanghai), China (Beijing), and China (Zhangjiakou).
Features
The following table describes the features supported by time series tables.
Feature | Description |
Create a time series table | When you create a time series table, you must specify the configuration information related to the time series table and time series metadata. In addition, you can specify custom time series identifiers and custom data fields as the primary key columns, create an analytical store, and create a Lastpoint index based on your business requirements. |
Update a time series table | You can modify the configuration information, such as the time to live (TTL) of a time series table. You can also modify the time series metadata configuration information, such as the TTL of time series metadata and whether attribute columns of the time series metadata table can be modified. |
Query time series tables | You can query the names and configuration information of all time series tables in the current instance. |
Query information of a time series table | You can query the status and configuration information, such as the TTL of a time series table. You can also query the time series metadata configuration information, such as the TTL of time series metadata and whether attribute columns of the time series metadata table can be modified. |
Delete a time series table | You can delete a time series table. |
Procedure
Create a time series table
Perform the following operations to create a time series table in the Tablestore console.
Go to the Instance Management page.
Log on to the Tablestore console.
In the top navigation bar, select a resource group and a region.
On the Overview page, click the instance alias or click Manage Instance in the Actions column of the instance.
On the Instance Details tab, click the Time Series Tables tab.
On the Time Series Tables tab, click Create Time Series Table.
NoteYou can also click Generate Demo with One Click to create a test table with sample data to quickly experience the features. For a newly created test table, the system performs specific initialization operations. You must wait about tens of seconds before the time series is displayed.
In the Create Time Series Table dialog box, configure the parameters. The following table describes the parameters.
Parameter
Description
Name
The name of the time series table, which is used to uniquely identify the time series table in the instance.
The name must be 1 to 128 characters in length and can contain only letters, digits, and underscores (_). The name must start with a letter or an underscore (_).
The name of the time series table must be different from the name of an existing data table, secondary index, or other time series tables in the current instance.
Time to Live
The retention period of data in the time series table. Unit: seconds. The minimum TTL is 86,400 seconds (one day). You can also set the Time to Live parameter to -1, which specifies that the data never expires.
If the system detects that the difference between the current time and the time when the data column is passed to the table exceeds the specified TTL value, the system automatically deletes the expired data.
NoteIn a time series table, the system determines the time when the data is generated based on the time column that is passed to the table, not based on the time when the data is written to the table.
Time Series Identifier
NoteYou can configure this parameter only when you turn on the Custom Time Series Identifiers and Primary Key switch.
By default, time series identifiers consist of the metric name, data source, and tags. You can specify custom time series identifiers based on your business requirements. For more information, see Specify custom time series identifiers.
The name of a custom time series identifier field must contain lowercase letters, digits, and underscores (_) and cannot start with a digit. The name must be 1 to 128 bytes in length.
You can specify a maximum of six custom time series identifier fields.
You can click Add Time Series Identifier to add multiple custom time series identifier fields. You can click the
icon next to a custom time series identifier field to delete the field.
ImportantAfter a time series table is created, you cannot modify the custom time series identifier fields. Proceed with caution.
Primary Key Fields
NoteYou can configure this parameter only when you turn on the Custom Time Series Identifiers and Primary Key switch.
If you want to store multiple rows of time series data with the same time series identifiers and timestamp, you can specify custom data fields as the primary key columns of the time series table. For more information, see Specify custom time series identifiers and custom data fields as the primary key columns.
The name of a data field that is specified as a primary key column must consist of lowercase letters, digits, and underscores (_) and cannot start with a digit. The name must be 1 to 128 bytes in length.
You can specify a maximum of four data fields as the primary key columns.
The data type of a data field that is specified as a primary key column can be STRING or INTEGER.
You can click Add Primary Key Field to add multiple data fields as the primary key columns. You can click the
icon next to a data field that is specified as a primary key column to delete the field.
ImportantAfter a time series table is created, you cannot modify the data fields that are specified as the primary key columns. Proceed with caution.
Create Analytical Store
You can use an analytical store to store time series data at a low cost and quickly query and analyze time series data. The analytical store feature is primarily used for long-term storage and analysis of time series data. For more information, see Analytical store for time series.
The Create Analytical Store switch is turned on by default. Configure the setting of the switch based on your business requirements.
If you do not want to use the analytical store feature, turn off the Create Analytical Store switch.
If you want to create a default analytical store, retain the default setting of the Create Analytical Store switch.
If you want to create a custom analytical store, keep the default setting of the Create Analytical Store switch, turn on the Advanced Settings switch, and configure the Name and TTL parameter.
Create LastPoint Index
Lastpoint indexes are specifically designed to quickly retrieve the latest status of each time series in a time series table. You can use a Lastpoint index to quickly retrieve data of the latest point in time in time series in a time series table. For more information, see Lastpoint index.
The Create LastPoint Index switch is turned off by default. Configure the setting of the switch based on your business requirements.
If you do not want to create a Lastpoint index, retain the default setting of the Create LastPoint Index switch.
If you want to create a Lastpoint index, turn on the Create LastPoint Index switch and configure the LastPoint Index Name parameter.
NoteThe name of a Lastpoint index must contain letters, digits, and underscores (_) and cannot start with a digit. The name must be 1 to 128 bytes in length.
The total number of Lastpoint indexes and analytical stores that are created for a time series table cannot exceed 10.
Click Create.
After the time series table is created, you can view it on the Time Series Tables tab. If the table is not displayed in the list of time series tables on the Time Series Tables tab, you can click the
icon to refresh the list of time series tables.
Manage time series tables
Perform the corresponding operations to manage time series tables based on your business requirements.
Feature | Description |
List time series tables | On the Time Series Tables tab, view all time series tables in the instance. |
Modify the TTL of data in a time series table |
|
Modify the TTL of time series metadata |
|
Specify whether the attributes of time series metadata can be modified |
|
Query information of a time series table |
|
Delete a time series table |
|
Development integration
Feature | Call method |
Create a time series table | |
Update a time series table | |
List time series tables | |
Query information of a time series table | |
Delete a time series table |