In the shared storage mode of OceanBase Database, full data is stored in object storage with lower costs, while frequently accessed or actively used hot data is cached locally to accelerate business queries. Caching hot data is an optimization method for storage costs and database performance. By default, the system dynamically caches hot data (frequently accessed) and evicts cold data (infrequently accessed) based on data access frequency and generation time. However, for sensitive queries, this automatic identification may introduce unexpected RT jitter.
For business scenarios with clear hot and cold data distinctions, such as time-sensitive applications, you can define hot data ranges based on business characteristics (e.g., time boundaries) to customize hot data caching strategies. This approach overcomes the limitations of automatic hot/cold data identification, enhancing performance predictability. By pre-caching hot data locally, you can avoid RT jitter during queries.
Applicable scenarios
- Time-sensitive business: Applications that only need to view recent data.
- High RT stability requirements: Applications sensitive to query latency for frequently accessed data.
Hot data caching mechanism
Data attribute types:
HOT: Hot data is cached locally as much as possible. If local storage capacity allows, all hot data is cached locally.AUTO: The system automatically identifies hot/cold data based on access frequency and dynamically prefetches and caches data.NONE: Inherits the hot/cold caching strategy from the parent entity (e.g., a primary table). For example, if a local index has a caching strategy ofNONE, it dynamically inherits the strategy from the primary table.Note
When the hot/cold caching strategy follows the value of
STORAGE_CACHE_POLICYat the parent level:- For a subpartition, the parent level is the partition.
- For a partition, the parent level is the table.
- For an index table, the parent level is the primary table.
Priority mechanism:
- User-defined hot data has higher priority than automatically identified hot data.
Hotspot caching strategy support
OceanBase Database supports customizing hot/cold caching strategies using SQL statements in the shared storage mode:
- Creating tables (user tables/index tables) with specified table-level and partition-level hot/cold caching strategies (
STORAGE_CACHE_POLICY). - Modifying table-level and partition-level hot/cold caching strategies (
STORAGE_CACHE_POLICY) for tables (user tables/index tables).
- Creating tables (user tables/index tables) with specified table-level and partition-level hot/cold caching strategies (
OceanBase Database provides configuration items to set global hot/cold caching strategies:
- Configuring the default caching strategy default_storage_cache_policy.
- Enabling user-defined hot/cold caching strategies enable_manual_storage_cache_policy.
- Pausing background caching tasks suspend_storage_cache_task.
OceanBase Database provides views to view caching strategies:
- V$OB_TABLET_LOCAL_CACHE displays the overall caching status of each tenant on the current OBServer node.
- V$OB_STORAGE_CACHE_TASKS displays the caching task information of each tenant on the current OBServer node.
