全部產品
Search
文件中心

Tablestore:查詢分析儲存資訊

更新時間:Aug 04, 2026

使用 Java SDK 查詢分析儲存的配置、資料同步狀態和儲存量。

前提條件

安裝Tablestore Java SDK並初始化時序模型用戶端。分析儲存功能需要使用 5.15.0 及以上版本,建議使用最新版本。

功能說明

調用 describeTimeseriesAnalyticalStore 方法查詢指定分析儲存的資料生命週期、同步方式、同步狀態和儲存量。

public DescribeTimeseriesAnalyticalStoreResponse describeTimeseriesAnalyticalStore(DescribeTimeseriesAnalyticalStoreRequest request) throws TableStoreException, ClientException

以下樣本查詢 example_timeseries_tableexample_analytical_store 的資訊。同步狀態或儲存量尚未產生時,對應欄位可能為空白。

TimeseriesClient timeseriesClient = client.asTimeseriesClient();

DescribeTimeseriesAnalyticalStoreRequest request =
        new DescribeTimeseriesAnalyticalStoreRequest(
                "example_timeseries_table", "example_analytical_store");
DescribeTimeseriesAnalyticalStoreResponse response =
        timeseriesClient.describeTimeseriesAnalyticalStore(request);

TimeseriesAnalyticalStore store = response.getAnalyticalStore();
System.out.println(store.getAnalyticalStoreName());
System.out.println(store.getTimeToLive());
System.out.println(store.getSyncOption());

AnalyticalStoreSyncStat syncStat = response.getSyncStat();
if (syncStat != null) {
    System.out.println(syncStat.getSyncPhase());
    System.out.println(syncStat.getCurrentSyncTimestamp());
}

AnalyticalStoreStorageSize storageSize = response.getStorageSize();
if (storageSize != null) {
    System.out.println(storageSize.getSizeInBytes());
    System.out.println(storageSize.getTimestamp());
}

參數說明

DescribeTimeseriesAnalyticalStoreRequest 包含以下參數。

名稱

類型

說明

timeseriesTableName(必選)

String

時序表名稱。

analyticalStoreName(必選)

String

分析儲存名稱。

傳回值

DescribeTimeseriesAnalyticalStoreResponse 包含以下業務返回欄位。

欄位

類型

說明

analyticalStore

TimeseriesAnalyticalStore

通過 getAnalyticalStore() 擷取分析儲存配置。

syncStat

AnalyticalStoreSyncStat

通過 getSyncStat() 擷取資料同步狀態。同步狀態尚未產生時可能為空白。

storageSize

AnalyticalStoreStorageSize

通過 getStorageSize() 擷取最近一次統計的儲存量。儲存量統計尚未產生時可能為空白。

分析儲存配置

analyticalStore 的類型為 TimeseriesAnalyticalStore,包含以下欄位。

欄位

類型

說明

analyticalStoreName

String

通過 getAnalyticalStoreName() 擷取分析儲存名稱。

timeToLive

int

通過 getTimeToLive() 擷取分析儲存的資料生命週期,單位為秒。值為 -1 時,表示資料永不到期。

syncOption

AnalyticalStoreSyncType

通過 getSyncOption() 擷取資料同步方式。

資料同步狀態

syncStat 的類型為 AnalyticalStoreSyncStat,包含以下欄位。

欄位

類型

說明

syncPhase

AnalyticalStoreSyncType

通過 getSyncPhase() 擷取當前同步階段,取值為 SYNC_TYPE_FULLSYNC_TYPE_INCR

currentSyncTimestamp

long

通過 getCurrentSyncTimestamp() 擷取當前同步時間戳記。

儲存量

storageSize 的類型為 AnalyticalStoreStorageSize,包含以下欄位。

欄位

類型

說明

sizeInBytes

long

通過 getSizeInBytes() 擷取分析儲存的資料量,單位為位元組。

timestamp

long

通過 getTimestamp() 擷取儲存量統計時間戳記。