You can call the CreateTimeseriesAnalyticalStore operation to create an analytical store for an existing time series table when you want to store time series data at a low cost and quickly query and analyze time series data.
Prerequisites
An instance for the TimeSeries model is created in a region that supports the analytical store feature. For more information, see Create an instance for the TimeSeries model.
A client is initialized. For more information, see Initialize a Tablestore client.
Parameters
Parameter | Description | |
timeseriesTableName | The name of the time series table. | |
analyticalStore | analyticalStoreName | The name of the analytical store. |
timeToLive | The time to live (TTL) of data in the analytical store. Unit: seconds. Valid values: -1 (data never expires) or a positive integer that is greater than or equal to 2592000 (30 days). If you want the data in the analytical store to never expire, you can set this parameter to -1. You can modify this parameter by calling the UpdateTimeseriesAnalyticalStore operation. | |
syncOption | The synchronization option of the analytical store. Valid values:
| |
Examples
The following sample code provides an example on how to create an analytical store for the test_timeseries_table time series table. The analytical store is named test_analytical_store, with a TTL of 30 days (2592000 seconds), and the synchronization option set to SYNC_TYPE_INCR.
public void createAnalyticalStore(TimeseriesClient client) {
//Specify the name of the analytical store.
TimeseriesAnalyticalStore analyticalStore = new TimeseriesAnalyticalStore("test_analytical_store");
//Specify the TTL of data in the analytical store. Unit: seconds.
analyticalStore.setTimeToLive(2592000);
//Specify the mode in which data in the time series table is synchronized to the analytical store.
analyticalStore.setSyncOption(AnalyticalStoreSyncType.SYNC_TYPE_INCR);
//Specify the name of the time series table.
CreateTimeseriesAnalyticalStoreRequest request = new CreateTimeseriesAnalyticalStoreRequest("test_timeseries_table", analyticalStore);
client.createTimeseriesAnalyticalStore(request);
}