TimeSeries model

Updated at:

Tablestore SDK for Go provides a variety of operations on time series tables and time series data and analytical storagefor the TimeSeries model.

Note

The Tablestore TimeSeries model is designed based on the characteristics of time series data and is suitable for scenarios such as IoT device monitoring, device data collection, and machine data monitoring. For more information about the TimeSeries model, see Overview.

Operations on time series tables

To use the Tablestore TimeSeries model, you must call the CreateTimeseriesTable operation to create a time series table for storing time series data. For more information, see Create a time series table.

After you create a time series table, you can manage the time series table. The following table describes the operations that you can perform on time series tables.

Operation

Description

Query the names of time series tables

To view the existing time series tables in an instance, you can call the ListTimeseriesTable operation to query the names of all time series tables in the instance.

Query the information about a time series table

To view the configuration details of a time series table, you can call the DescribeTimeseriesTable operation to query the information about the time series table, such as the time to live (TTL) of data.

Update a time series table

To clear historical data in a time series table or extend the retention period of data, you can call the UpdateTimeseriesTable operation to modify the TTL of data in the time series table. After you modify the TTL of data in a time series table, Tablestore automatically and asynchronously clears the data that exceeds the TTL in the time series table.

Delete a time series table by using Go SDK

If you no longer need to use a time series table to store time series data, you can call the DeleteTimeseriesTable operation to 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 that is created for the time series table.

  • Time series tables cannot be restored after deletion. Please proceed with caution.

  • When deleting a time series table, the system automatically deletes the analytical storage under the time series table.

Analytical Storage Operations

To store time series data at low cost and quickly query and analyze time series data, you can create analytical storage for time series tables.

Note

The analytical storage feature is mainly used for long-term storage and analysis scenarios of time series data. For more information, see Analytical store.

After creating analytical storage, you can manage the analytical storage. For detailed operation instructions, see the following table.

Feature

Description

Query Analytical Storage Description Information

When you need to view detailed configuration information of analytical storage, you can use the DescribeTimeseriesAnalyticalStore interface to query analytical storage description information, such as data lifecycle configuration, data synchronization options, data synchronization status, and data storage size.

Update Analytical Storage Data Lifecycle

When you need to clean up historical data in analytical storage or extend data retention time, you can use the UpdateTimeseriesAnalyticalStore interface to update the data lifecycle TTL configuration of time series analytical storage. After updating the TTL of analytical storage, Tablestore automatically and asynchronously cleans up data in analytical storage that exceeds the TTL.

Delete Analytical Storage

When you no longer need to use analytical storage for low-cost storage and querying and analyzing time series data, you can use the DeleteTimeseriesAnalyticalStore interface to delete the analytical storage under the time series table.

Operations on time series data

After you create a time series table, you can call the PutTimeseriesData operation to write multiple rows of time series data to the time series table at a time. For more information, see Write time series data. When time series data is written to a time series table, the analytical storage automatically synchronizes data from the time series table.

After time series data is written to a time series table, you can perform the following operations to query the time series data of a time series in the time series table:

  1. If you are not sure about the information about the time series that you want to query, such as the metric name and data source, you can call the QueryTimeseriesMeta operation to specify multiple conditions to retrieve the time series. For more information, see Retrieve time series.

    If the property information in time series metadata does not meet your requirements, you can update or delete the time series metadata.

    Operation

    Description

    Update time series metadata

    You can call the UpdateTimeseriesMeta operation to modify multiple properties in time series metadata at a time.

    Delete time series metadata

    You can call the DeleteTimeseriesMeta operation to delete the metadata of multiple time series at a time.

  2. You can call the GetTimeseriesData operation to query the time series data that meets specific conditions in a specific time series. For more information, see Query time series data.

After you write time series data to the time series table, if you want to use an analytical store to query and analyze the time series data in a time series, you can create a mapping table for the analytical store and execute the SELECT statement to query time series data. For more information, see SQL query examples.