All Products
Search
Document Center

Tablestore:Quick Start of timeseries model

Last Updated:Feb 28, 2025

The timeseries model is designed based on the characteristics of time series data. It is suitable for scenarios such as IoT device monitoring, device data collection, and machine monitoring data. It provides high concurrency for writing and querying, along with low-cost storage for PB-level massive data.This topic describes how to use the timeseries model in the console.

Important

For more information on utilizing the timeseries model via the command line tool, see Using the timeseries model with the command line tool.

Notes

Currently, the regions that support the timeseries model feature include China (Hangzhou), China (Shanghai), China (Beijing), China (Zhangjiakou), China (Ulanqab), China (Shenzhen), China (Chengdu), Hong Kong (China), Japan (Tokyo), Singapore, Malaysia (Kuala Lumpur), Indonesia (Jakarta), Germany (Frankfurt), UK (London), US (Silicon Valley), US (Virginia), SAU (Riyadh - Partner Region).

Preparations

  1. The Tablestore service is activated. For specific operations, see Activate the Tablestore service.

  2. Create a timeseries model instance.

    1. Log on to the Tablestore console.

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

    3. On the Overview page, click Create Timeseries Model Instance.

    4. In the Create Timeseries Model Instance dialog box, select the instance type, enter the instance name, and fill in the instance comment based on your business needs.

    5. Click OK.

Procedure

Step 1: Create a timeseries table

Create a timeseries table to store time series data.

For sample scenarios and table structure information, see Sample Scenarios.
  1. Go to the Instance Management page.

    1. Log on to the Tablestore console.

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

    3. On the Overview page, click the instance name or click Instance Management in the Actions column of the instance.

  2. On the Instance Details tab, click the Timeseries Table List tab.

  3. On the Timeseries Table List tab, click Create Timeseries Table.

    Note

    You can also click Generate Sample With One Click to create a test table and sample data for a quick experience of the feature. When a new test table is created, the system performs specific initialization operations. You must wait for dozens of seconds before the time series are displayed.

  4. In the Create Timeseries Table dialog box, enter Timeseries Table Name as car_example, and keep other parameters as default.

    image

  5. Click OK.

    After the timeseries table is created, you can view the created timeseries table on the Timeseries Table List tab. If the newly created table is not displayed in the list, click the fig_tablestore_002 icon to refresh the timeseries table list.

    image

Step 2: write data

Write time series data to the timeseries table. 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 Timeseries Table List tab, click the timeseries table name and then select the Data Management tab or click Data Management in the Actions column of the timeseries table.

  2. (Optional) Create a new time series.

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

    2. In the Add Time Series dialog box, add time series metadata such as measurement name and data source.

      image

    3. Click Add.

  3. Insert data.

    1. Click Query Data in the Actions column of the specified time series.

    2. Click Insert Data.

      The system automatically obtains the metadata of the selected time series.

    3. In the Insert Data dialog box, set the time and property columns.

      image

    4. Click OK.

Step 3: Query time series data

Retrieve data from a specific time series within a designated time frame.

For additional details on querying table data with SQL, see Using SQL to Query Time Series Data.
If you're uncertain of the details for the time series data you want to query, you can define multiple conditions to retrieve all time series that satisfy those conditions. For detailed instructions, see Retrieve Time Series.
  1. On the Data Management tab of the time series table, click Query Data in the Actions column for the desired time series.

  2. Specify the query conditions.

    1. By default, query results are sorted chronologically. If you prefer to view data in reverse chronological order, set Reverse Query to Yes.

    2. Choose a search method and define a time range.

  3. Click Query.

    The data matching the query conditions will be displayed on the Data Management tab, available in either list or graph format.

Retrieve time series

If you're uncertain about the details of the time series you want to query, such as the measurement and data source, you can set multiple criteria to retrieve all time series that match your specified conditions.

  1. On the Data Management tab of the time series table, click Query Time Series in the upper-right corner.

  2. In the Query Data dialog box, enter the measurement name or data source for the time series, and click Add in the corresponding area to establish the matching conditions for tags, properties, or update times as needed.

    The conditions shown in the figure below are for querying all time series that include car_model=model_A in the tags.

    image

  3. Click OK.

    The data matching the query conditions will be displayed on the Data Management tab.

Sample scenarios

In the Internet of Vehicles scenario, vehicles transmit time series data to the cloud via sensors. By storing, querying, and analyzing this time series data, users can fulfill business requirements such as generating vehicle condition reports, tracking vehicle locations, managing traffic, and projecting travel paths. This topic illustrates the process of creating a time series table and executing data read and write operations using a time series table named car_example, which stores vehicle time series data (primarily vehicle trajectory information) in the Internet of Vehicles scenario. The structure of the table is outlined below:

Field Name

Data Type

Description

_m_name

String

The measurement name, which indicates the name of the physical quantity or monitoring metric measured by the time series data.

_data_source

String

The data source, which indicates the identifier of the data source that generates the time series. It can be empty.

_tags

String

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

_time

Integer

The data reporting time.

vin_id

String

The vehicle identification number (VIN), which is used to uniquely identify the vehicle.

model

String

The vehicle model.

speed

Double

The current speed.

gps

String

The GPS coordinates of the vehicle, in the format of latitude,longitude, with latitude first and longitude second. The latitude range is [-90,+90], and the longitude range is [-180,+180]. For example, 30.23,52.78.

current_mileage

Double

The current mileage.

remaining_oil

Double

The remaining oil volume.

available_mileage

Double

The remaining available mileage.

tire_pressure

Double

The tire pressure data.