All Products
Search
Document Center

Tablestore:Use the TimeSeries model in the Tablestore console

Last Updated:Jan 15, 2024

After you create a time series table in the Tablestore console, you can write time series data to the time series table, and retrieve time series and query time series data in the time series table.

Prerequisites

An instance for the TimeSeries model is created. For more information, see Create an instance for the TimeSeries model.

Precautions

  • The TimeSeries model starts charging fees since May 26, 2022.

  • The TimeSeries model is available in the following regions: China (Hangzhou), China (Shanghai), China (Beijing), China (Zhangjiakou), China (Shenzhen), Germany (Frankfurt), and Singapore (Singapore).

Step 1: Create a time series table

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, find the instance that you want to manage. Click the instance name or click Manage Instance in the Actions column.

  2. In the lower part of 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 for a quick start. When you create a time series table, the system performs some initialization operations. Therefore, you need to wait for dozens of seconds until the time series are displayed.

  4. In the Create Time Series Table dialog box, configure the parameters that are described in the following table.

    Parameter

    Description

    Name

    The name of the time series table, which is used to uniquely identify the time series table in an instance.

    The name must be 1 to 128 characters in length and can contain letters, digits, and underscores (_). The name must start with a letter or an underscore (_).

    The name of a time series table cannot be the same as the name of an existing data table.

    Time to Live

    The retention period of the data in the time series table. Unit: seconds. If the system detects that the difference between the current time and the time column that is passed to the table exceeds the specified time to live (TTL) value, the system automatically deletes the expired data.

    Important

    In the 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 the time when the data is written to the table.

    The value of this parameter must be -1 or a value that is greater than or equal to 86400. A value of -1 indicates that the data never expires. A value of 86400 indicates one day.

  5. Click OK.

    After the time series table is created, you can view the time series table on the Time Series Tables tab. If the time series table is not displayed in the list of time series tables, click the fig_tablestore_002 icon to refresh the list.

Step 2: Write time series data

Write time series data to the time series table in the Tablestore console. Time series data consists of metadata and data. If you do not create metadata before you write the time series data, the system automatically extracts the metadata from the written data.

  1. On the Time Series Tables tab, click the name of the time series table that you want to manage, and then click the Query Data tab. You can also click Manage Data in the Actions column that corresponds to the time series table.

  2. Optional. Create a time series.

    1. On the Query Data tab, click Add Time Series.

    2. In the Add Time Series dialog box, configure the metadata of the time series.

      fig_datatimeseries

      The following table describes the parameters.

      Parameter

      Description

      Metric Name

      The name of a physical quantity or metric for the data in the time series. Example: cpu or net, which specifies that the CPU utilization 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 left empty.

      Tag

      The tag of the time series. You can customize multiple key-value pairs of the STRING type.

      Property

      The property column of the time series, which is used to record some property information of the time series.

    3. Click OK.

  3. Insert data.

    1. Click Insert Data.

    2. In the Insert Data dialog box, configure the Time and Attribute Column parameters.fig_datatimeseries

    3. Click OK.

Step 3: Retrieve time series

Retrieve all the time series that meet the specified conditions.

  1. On the Query Data tab, click Query Data in the upper-right corner.

  2. In the Query Data dialog box, configure the Metric Name and Data Source parameters, and click Add in the Tag, Property, and Updated At sections to add conditions.

    The following figure shows an example on how to query the time series in which the metric name is cpu and the tags contain os=Ubuntu16.10.fig_querytimeseries

  3. Click OK.

    The time series that meet the conditions are displayed on the Query Data tab.

Step 4: Query time series data

Query the data in a time series within a specific time range.

  1. On the Query Data tab, find the time series that you want to manage and click Query Data in the Actions column.

  2. Select Time Range or Microsecond Timestamp from the Search Method drop-down list, specify the time, and then click Search.

    The data that meets the conditions is displayed on the Query Data tab. The query results can be displayed in a list or figure.

    Example of displaying results in a list

    fig_timeseriesdataquery

    Example of displaying results in a figure

    Note

    Different colors in the figure represent different data columns. If you move the pointer over the data trend line, the values of the corresponding data columns are displayed. You can also select or clear specific data columns to display the required data columns.

    fig_picdisplay

Appendix: Manage a time series table

After you create a time series table, you can perform operations on the time series table as needed.

Operation

Description

Modify the TTL of data in a time series table

If you want to clear historical data or extend the data retention period for a time series table, you can modify the TTL of the data in the time series table. After you modify the TTL of the data in a time series table, Tablestore automatically and asynchronously clears the data whose retention period exceeds the TTL.

  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 Data Lifecycle.

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

    The TTL value is the retention period of the data in the time series table. Unit: seconds. The value must be -1 or a value that is greater than or equal to 86400. A value of -1 indicates that the data never expires. A value of 86400 indicates one day.

  4. Click Yes.

Modify the TTL of time series metadata

If you want to clear specific historical time series metadata or extend the retention period of the time series metadata, you can modify the TTL of the time series metadata. After you modify the TTL of the time series metadata, Tablestore automatically and asynchronously clears the metadata whose retention period exceeds the TTL.

  1. On the Time Series Tables tab, click the name of the time series table.

  2. In the Description section of the Basic Information tab, click the image.png icon next to Timeline TTL.

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

    The TTL value is the retention period of the time series metadata in the time series table. Unit: seconds. The value must be -1 or a value that is greater than or equal to 604800. A value of -1 indicates that the metadata never expires. A value of 604800 indicates seven days.

  4. Click Yes.

Allow or disallow modifying the property columns of time series metadata

By default, the property columns of time series metadata can be modified. You can disallow modifying the property columns 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 Timeline metadata properties allow updates.

  3. In the dialog box that appears, select Yes or No.

  4. Click Yes.

Delete a time series table

If you no longer need to use a time series table to store time series data, you can delete the time series table.

Important
  • You cannot restore a time series table after it is deleted. Exercise caution when you perform this operation.

  • When you delete a time series table, the system automatically deletes the analytical store under the time series table.

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

  2. In the message that appears, click OK.