All Products
Search
Document Center

Tablestore:Update the TTL of an analytical store

Last Updated:Aug 04, 2026

Use Tablestore SDK for Java to update the TTL of an analytical store to extend data retention or delete historical data.

Prerequisites

Install Tablestore SDK for Java and initialize a time series model client. Analytical store operations require Tablestore SDK for Java 5.15.0 or later. We recommend that you use the latest version.

Feature description

Call the updateTimeseriesAnalyticalStore method to update the TTL of an analytical store. The data synchronization mode of an analytical store cannot be updated.

public UpdateTimeseriesAnalyticalStoreResponse updateTimeseriesAnalyticalStore(UpdateTimeseriesAnalyticalStoreRequest request) throws TableStoreException, ClientException
Important
  • After a finite TTL is configured, data that exceeds the TTL becomes unreadable immediately and is asynchronously deleted by Tablestore.

  • Decreasing the TTL may cause some data to expire immediately. After the TTL is increased, data that was outside the previous TTL becomes readable again if it has not been deleted and falls within the new TTL.

The following sample code updates the TTL of example_analytical_store in example_timeseries_table to 30 days.

TimeseriesClient timeseriesClient = client.asTimeseriesClient();

TimeseriesAnalyticalStore analyticalStore =
        new TimeseriesAnalyticalStore("example_analytical_store");
analyticalStore.setTimeToLive(2592000);

UpdateTimeseriesAnalyticalStoreRequest request =
        new UpdateTimeseriesAnalyticalStoreRequest("example_timeseries_table");
request.setAnalyticStore(analyticalStore);

timeseriesClient.updateTimeseriesAnalyticalStore(request);

Parameters

UpdateTimeseriesAnalyticalStoreRequest contains the following parameters.

Name

Type

Description

timeseriesTableName (required)

String

The name of the time series table.

analyticStore (required)

TimeseriesAnalyticalStore

The analytical store configuration to update.

Analytical store configuration

analyticStore is of the TimeseriesAnalyticalStore type and contains the following parameters.

Name

Type

Description

analyticalStoreName (required)

String

The name of the analytical store.

timeToLive (required)

int

The analytical store TTL in seconds. Set the value to -1 or an int32 integer of at least 2592000. A value of -1 means that data does not expire.