TimeSeries model
Tablestore SDK for Go provides a variety of operations on time series tables and time series data and analytical storagefor the TimeSeries model.
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 |
|
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. |
|
|
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. |
|
|
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. |
|
|
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
|
Operations on analytical stores
To store time series data at low costs and query and analyze time series data at high speeds, you can create an analytical store for a time series table.
The analytical store feature is suitable for long-term storage and analysis of time series data. For more information, see Analytical store.
-
You can create an analytical store when you create a time series table. For more information, see Create a time series table.
-
After you create a time series table, you can call the CreateTimeseriesAnalyticalStore operation to create an analytical store for the existing time series table. For more information, see Create an analytical store.
After you create an analytical store, you can manage the analytical store. The following table describes the operations that you can perform on analytical stores.
|
Operation |
Description |
|
To view the configuration details of an analytical store, you can call the DescribeTimeseriesAnalyticalStore operation to query the description of the analytical store, such as the time to live (TTL) configuration, data synchronization options, data synchronization status, and data storage size. |
|
|
To clear historical data in an analytical store or extend the retention period of data, you can call the UpdateTimeseriesAnalyticalStore operation to update the TTL configuration of the time series analytical store. After you update the TTL of an analytical store, Tablestore automatically and asynchronously clears the data that exceeds the TTL in the analytical store. |
|
|
If you no longer need to use an analytical store to store, query, and analyze time series data at low costs, you can call the DeleteTimeseriesAnalyticalStore operation to delete the analytical store of 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:
-
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
You can call the UpdateTimeseriesMeta operation to modify multiple properties in time series metadata at a time.
You can call the DeleteTimeseriesMeta operation to delete the metadata of multiple time series at a time.
-
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.