All Products
Search
Document Center

Tablestore:Update time series table configurations

Last Updated:Aug 03, 2026

Use Tablestore SDK for Java to update the time-to-live (TTL) of time series data and metadata and specify whether metadata attribute columns can be updated.

Prerequisites

Install the Tablestore SDK for Java and initialize a time series client.

Description

Call updateTimeseriesTable to update time series table configurations. Each request can update either time series data configurations or metadata configurations, but not both.

public UpdateTimeseriesTableResponse updateTimeseriesTable(UpdateTimeseriesTableRequest request)

The following example updates the time series data TTL of example_timeseries_table to three years.

TimeseriesClient timeseriesClient = client.asTimeseriesClient();

String tableName = "example_timeseries_table";
UpdateTimeseriesTableRequest request =
        new UpdateTimeseriesTableRequest(tableName);
request.setTimeseriesTableOptions(
        new TimeseriesTableOptions(86400 * 365 * 3));

timeseriesClient.updateTimeseriesTable(request);

Parameters

UpdateTimeseriesTableRequest contains the following parameters.

Name

Type

Description

timeseriesTableName (required)

String

The name of the time series table whose configurations you want to update.

timeseriesTableOptions (optional)

TimeseriesTableOptions

The time series data configurations. You must specify either timeseriesTableOptions or timeseriesMetaOptions, but not both.

timeseriesMetaOptions (optional)

TimeseriesMetaOptions

The time series metadata configurations. You must specify either timeseriesTableOptions or timeseriesMetaOptions, but not both.

Time series data configurations

timeseriesTableOptions is of the TimeseriesTableOptions type and contains the following parameter.

Name

Type

Description

timeToLive (required)

int

The time series data TTL in seconds. Set the value to -1 or an integer of at least 86,400. A value of -1 means that the data does not expire.

Tablestore automatically deletes expired data.

If the metadata TTL is not -1, this value cannot exceed the metadata TTL. Before you set this value to -1, set the metadata TTL to -1.

Time series metadata configurations

timeseriesMetaOptions is of the TimeseriesMetaOptions type. Specify at least one of the following parameters. An omitted parameter retains its current value.

Name

Type

Description

metaTimeToLive (optional)

int

The time series metadata TTL in seconds. Set the value to -1 or an integer of at least 604,800. A value of -1 means that the metadata does not expire.

This value cannot be less than the time series data TTL. If the data TTL is -1, this value must also be -1.

If you configure a finite TTL, set allowUpdateAttributes to false.

allowUpdateAttributes (optional)

boolean

Specifies whether metadata attribute columns can be updated. If the metadata TTL is not -1, this value must be false.

Examples

Update time series metadata configurations

The following example configures time series metadata to never expire and allows metadata attribute columns to be updated.

String tableName = "example_timeseries_table";
TimeseriesMetaOptions metaOptions = new TimeseriesMetaOptions();
metaOptions.setMetaTimeToLive(-1);
metaOptions.setAllowUpdateAttributes(true);

UpdateTimeseriesTableRequest request =
        new UpdateTimeseriesTableRequest(tableName);
request.setTimeseriesMetaOptions(metaOptions);

timeseriesClient.updateTimeseriesTable(request);