This topic describes how to modify the partition-level hot cache policy (STORAGE_CACHE_POLICY) by using SQL statements.
Considerations
You can modify the partition-level hot cache policy only in shared storage mode.
Modify the partition-level hot cache policy
Note
For OceanBase Database V4.3.5, you can modify the partition-level hot cache policy in shared storage mode starting from V4.3.5 BP2.
After you create a partitioned table, you can use the ALTER TABLE statement to specify the STORAGE_CACHE_POLICY when you add partitions and to modify the STORAGE_CACHE_POLICY of existing partitions. The syntax is as follows:
Specify the
STORAGE_CACHE_POLICYwhen you add partitions:ALTER TABLE table_name ADD PARTITION (partition_list [STORAGE_CACHE_POLICY = {"hot" | "auto" | "none"}]);Modify the
STORAGE_CACHE_POLICYof existing partitions:ALTER TABLE table_name ALTER PARTITION (partition_list [STORAGE_CACHE_POLICY = {"hot" | "auto" | "none"}]);
Parameters
The STORAGE_CACHE_POLICY at the partition level is an optional parameter. Valid values:
hot: indicates that all data in the specified partition is hot data. If the cache disk space is sufficient, all data in the partition is cached to the local cache disk.auto: indicates that the hot data in the specified partition is automatically identified by the system.none: default value. The hot cache policy of the partition follows the value of theSTORAGE_CACHE_POLICYat the upper level.
For more information about how to modify a partitioned table, see Add a partition and Modify a partition rule.
Examples
Add a partition
p2to thetbl1table. The hot data in thep2partition is automatically identified by the system.ALTER TABLE tbl1 ADD PARTITION (PARTITION p2 VALUES LESS THAN(300) STORAGE_CACHE_POLICY = "auto");Modify the data in the
p1partition of thetbl1table to hot data.ALTER TABLE tbl1 ALTER PARTITION p1 STORAGE_CACHE_POLICY = "hot";Modify the data in the
sp3subpartition of thetbl2table to hot data. The hot data is automatically identified by the system.ALTER TABLE tbl2 ALTER SUBPARTITION sp3 STORAGE_CACHE_POLICY = "auto";
