All Products
Search
Document Center

Tablestore:Operations on time series tables

Last Updated:Apr 21, 2025

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.

    Note

    A 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.

  1. Go to the Instance Management page.

    1. Log on to the Tablestore console.

    2. In the top navigation bar, select a resource group and a region.

    3. On the Overview page, click the instance alias or click Manage Instance in the Actions column of the instance.

  2. On the Instance Details tab, click the Time Series Tables tab.

  3. On the Time Series Tables tab, click Create Time Series Table.

    Note

    You 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.

  4. 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.

    Note

    In 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

    Note

    You 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 fig_20221020_delete icon next to a custom time series identifier field to delete the field.

    Important

    After a time series table is created, you cannot modify the custom time series identifier fields. Proceed with caution.

    Primary Key Fields

    Note

    You 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 fig_20221020_delete icon next to a data field that is specified as a primary key column to delete the field.

    Important

    After 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.

      Note
      • The 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.

  5. 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 fig_tablestore_002 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

  1. On the Time Series Tables tab, click the name of the time series table that you want to manage.

  2. In the Description section of the Basic Information tab, click the image.png icon next to the Data Lifecycle parameter.

  3. In the dialog box that appears, modify the TTL value.

    The TTL value is 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 TTL to -1, which specifies that the data never expires.

    Note

    After you update the TTL of a time series table, Tablestore automatically deletes time series data whose retention period exceeds the TTL in the time series table in an asynchronous manner.

  4. Click Yes.

Modify the TTL of time series metadata

  1. On the Time Series Tables tab, click the name of the time series table that you want to manage.

  2. In the Description section of the Basic Information tab, click the image.png icon next to the TTL of Time Series Metadata parameter.

  3. In the dialog box that appears, modify the TTL of time series metadata.

    The TTL value is the retention period of time series metadata in the time series table. Unit: seconds. The minimum value is 604,800 seconds (seven days). You can also set the TTL to -1, which specifies that the time series metadata never expires.

    Note
    • The default value of the TTL of time series metadata is -1, which specifies that the time series metadata never expires.

      • The value of the TTL of time series metadata must be greater than or equal to the TTL of data in the time series table.

      • If you want to change the TTL of time series metadata to a value other than -1 (the minimum value is 604,800 seconds), make sure that you do not need to update time series metadata attributes in your business logic and set Whether to Update Attributes of Time Series Metadata to No.

      • If you want to set Whether to Update Attributes of Time Series Metadata to Yes, make sure that the value of the TTL of time series metadata is -1.

    • After you update the TTL of time series metadata, Tablestore automatically deletes time series whose retention period exceeds the TTL in an asynchronous manner, but does not delete the corresponding time series data. You can still query the time series data by specifying time series identifiers.

  4. Click Yes.

Specify whether the attributes of time series metadata can be modified

  1. On the Time Series Tables tab, click the name of the time series table that you want to manage.

  2. In the Description section of the Basic Information tab, click the image.png icon next to Whether to Update Attributes of Time Series Metadata.

  3. In the dialog box that appears, select whether to allow updates to attributes of time series metadata.

    Note

    If you want to allow updates to attributes of time series metadata, you must set TTL of Time Series Metadata to -1, which specifies that the time series metadata never expires.

  4. Click Yes.

Query information of a time series table

  1. On the Time Series Tables tab, click the name of the time series table that you want to manage.

  2. On the Basic Information tab, view information of the time series table in the Description, Time Series Identifier, Primary Key Fields, Analytical Store, and LastPoint Index sections.

Delete a time series table

  1. On the Time Series Tables tab, click Delete in the Actions column of the time series table that you want to delete.

  2. In the message that appears, click OK.

    Important
    • After a time series table is deleted, it cannot be recovered. Proceed with caution.

    • When you delete a time series table, the system automatically deletes the analytical stores and Lastpoint indexes that are created for the 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