tencent cloud

TDSQL Boundless

PERSIST_RANGE_CACHE

Download
Focus Mode
Font Size
Last updated: 2026-05-26 15:28:08

Function

information_schema.PERSIST_RANGE_CACHE is used to view the contents of the instance's persistent range statistics cache.
When generating execution plans, the TDSQL Boundless query optimizer estimates the number of rows for index scans based on Range Statistics. The PERSIST_RANGE_CACHE view displays the portion of these statistics that has been persisted and can be automatically recovered after a node restart, helping you:
View the instance's current persistent range statistics.
Verify whether range statistics are successfully recovered after a node restart.
Compare it with the in-memory view RANGE_CACHE to confirm their consistency.

Applicable Version

TDSQL Boundless kernel version 21.2.6 or later.

Field Description

The meanings of the fields in the PERSIST_RANGE_CACHE view are shown in the following table:
Field Name
Type
Description
TABLE_SCHEMA
varchar(192)
The database name to which the table of this range statistic belongs.
TABLE_NAME
varchar(192)
The table name to which the range statistic belongs.
INDEX_NAME
varchar(192)
The name of the index to which the range statistic belongs; primary key statistics are displayed as PRIMARY.
RANGE_CACHE_MISS
bigint unsigned
The cumulative number of misses for this index in the range statistics cache, which can be used to evaluate the cache hit rate.
RANGE_CACHE_SAMPLE_ROWS
bigint unsigned
The total number of rows sampled during the most recent complete rebuild of the index range statistics, used for estimating the total number of rows in the table.
RANGE_CACHE_REFILL_TS
bigint unsigned
The timestamp of the most recent complete rebuild of the index range statistics, formatted as a readable value in the YYYYMMDDhhmmss format.
START_KEY
varchar(192)
The start key of the range (in a readable string format).
END_KEY
varchar(192)
The end key of the range (in a readable string format).
RANGE_ROWS
bigint unsigned
The estimated number of rows within the range (START_KEY, END_KEY].
RANGE_ACC_ROWS
bigint unsigned
Cumulative row estimation: the total estimated number of rows accumulated from the minimum key of the index to END_KEY, used for cross-range cumulative estimation.
RANGE_TIMESTAMP
bigint unsigned
The timestamp generated for this specific range statistic, formatted as a readable value in the YYYYMMDDhhmmss format.
Note:
The column structures of PERSIST_RANGE_CACHE and RANGE_CACHE are identical, with the only difference being their data sources:
RANGE_CACHE: the range statistics cached in the current node's memory.
PERSIST_RANGE_CACHE: the complete range statistics that have been persisted and can be automatically recovered after a node restart. The range statistics cached in memory are only a subset, limited by the maximum capacity of the range cache.

Examples

Example 1: Querying the Persistence Range Statistics of a Table

SELECT TABLE_SCHEMA,
TABLE_NAME,
INDEX_NAME,
START_KEY,
END_KEY,
RANGE_ROWS,
RANGE_ACC_ROWS,
RANGE_TIMESTAMP
FROM information_schema.PERSIST_RANGE_CACHE
WHERE TABLE_SCHEMA = 'your_db'
AND TABLE_NAME = 'your_table'
ORDER BY INDEX_NAME, START_KEY;

Example 2: Comparing the Consistency Between Memory and Persistence Range Statistics

Under normal circumstances, all range statistics in memory can find their corresponding records in the persistence layer. The following SQL statement is used to verify consistency and is expected to return an empty result set:
SELECT *
FROM information_schema.RANGE_CACHE
WHERE CONCAT(START_KEY, ' ', END_KEY) NOT IN (
SELECT CONCAT(START_KEY, ' ', END_KEY)
FROM information_schema.PERSIST_RANGE_CACHE
);
If a non-empty result appears, it indicates that the persistence for this range has not been completed (which typically occurs within a very short period after re-obtaining range statistics). You can simply execute the operation again later.

Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback