All Products
Search
Document Center

Tablestore:Get started with the TimeSeries model

Last Updated:Mar 18, 2025

The TimeSeries model is designed based on the characteristics of time series data. This model is suitable for scenarios, such as IoT device monitoring, and can be used to store data collected by devices and the monitoring data of machines. The TimeSeries model allows applications to write and read data with high concurrency and supports the storage of petabytes of data at low costs. This topic describes how to use the TimeSeries model in the Tablestore console.

Important

For information about how to use the Tablestore CLI to get started with the TimeSeries model, see Use the Tablestore CLI to get started with the TimeSeries model.

Usage notes

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.

Preparations

  1. Activate Tablestore. For more information, see Activate Tablestore.

  2. Create an instance for the TimeSeries model.

    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 Create Instance for TimeSeries Model.

    4. In the Create Instance for TimeSeries Model dialog box, configure the Instance Type and Instance Name parameters. You can configure the Instance Description parameter based on your business requirements.

    5. Click OK.

Procedure

Step 1: Create a time series table

Create a time series table to store time series data.

For information about sample scenarios and table schemas, see Sample scenarios.
  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 name of the instance that you want to manage or click Manage Instance in the Actions column of the instance.

  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 that has sample data for a quick start. When you create a time series table, the system performs specific initialization operations. You must wait for dozens of seconds before the time series are displayed.

  4. In the Create Time Series Table dialog box, set the Name parameter to car_example and retain the default settings for other parameters.

    image

  5. Click Create.

    After you create the time series table, 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 of time series tables.

    image

Step 2: Write data to the time series table

Write time series data to the time series 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 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 of 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, such as the metric name and data source.

      image

    3. Click Add.

  3. Insert data.

    1. Click Query Data in the Actions column of the time series that you want to manage.

    2. Click Insert Data.

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

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

      image

    4. Click OK.

Step 3: Query time series data

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

For information about how to query data in a time series table by using SQL statements, see Use SQL to query time series data.
If you are unsure about the information of the time series that you want to query, you can specify multiple conditions to retrieve the time series and then query time series data. For more information, see Retrieve time series.
  1. On the Query Data tab of the time series table, find the time series that you want to manage and click Query Data in the Actions column.

  2. Specify query conditions.

    1. By default, the query results are sorted in chronological order. To sort query results in reverse chronological order, set the Reverse Chronological Oder parameter to Yes.

    2. Select a search method and specify a time range.

  3. 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 a figure.

Retrieve time series

If you are unsure about the information of the time series that you want to query, such as the metric name and data source, you can specify multiple conditions to retrieve the time series.

  1. On the Query Data tab of the time series table, click Query Time Series 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 for which the car_model=model_A tag is added.

    image

  3. Click OK.

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

Sample scenarios

In the Internet of Vehicles (IoV) scenario, sensors report the time series data of vehicles to the cloud. Users can store, query, and analyze the time series data to meet business requirements, such as vehicle status report, vehicle positioning, traffic management, and screen mirroring of vehicle trajectory. This topic describes how to create a time series table and read and write the data in the time series table by using a time series table that stores the time series data of vehicles, such as vehicle trajectory information in the IoV scenario. The name of the time series table is car_example. The following table describes the schema of the table.

Field name

Data type

Description

_m_name

String

The name of the physical quantity or metric for data in the time series.

_data_source

String

The identifier of the data source for the time series. This field can be left empty.

_tags

String

The tags of the time series. You can specify multiple key-value pairs of the string type.

_time

Integer

The time when the data is reported.

vin_id

String

The vehicle identification number (VIN) of the vehicle.

model

String

The model of the vehicle.

speed

Double

The current speed of the vehicle.

gps

String

The GPS coordinates of the vehicle. The value of this field must be in the latitude,longitude format. Valid values of the latitude: [-90,+90]. Valid values of the longitude: [-180,+180]. Example: 30.23,52.78.

current_mileage

Double

The current mileage of the vehicle.

remaining_oil

Double

The amount of remaining fuel of the vehicle.

available_mileage

Double

The remaining drivable distance of the vehicle.

tire_pressure

Double

The tire pressure data of the vehicle.