You can call the UpdateTimeseriesTable operation to update the configurations of a time series table, such as the time to live (TTL).

Prerequisites

Parameters

For more information, see Create a time series table.

Example

Update the TTL of the data in a time series table named test_timeseries_table to three years.

private static void updateTimeseriesTable(TimeseriesClient client) {
    String tableName = "test_timeseries_table";
    UpdateTimeseriesTableRequest updateTimeseriesTableRequest = new UpdateTimeseriesTableRequest(tableName);
    updateTimeseriesTableRequest.setTimeseriesTableOptions(new TimeseriesTableOptions(86400 * 365 * 3)); // Update the TTL of the data in the time series table to three years. 
    client.updateTimeseriesTable(updateTimeseriesTableRequest);

    DescribeTimeseriesTableResponse describeTimeseriesTableResponse = client.describeTimeseriesTable(new DescribeTimeseriesTableRequest(tableName));
    TimeseriesTableMeta tableMeta = describeTimeseriesTableResponse.getTimeseriesTableMeta();
    System.out.println(tableMeta.getTimeseriesTableOptions().getTimeToLive()); // View the updated TTL configuration of the time series table. 
}