All data in OceanBase AI Database is stored on low-cost object storage. Hot data that is frequently accessed or in use is cached in local storage whenever possible to accelerate business queries. Data that is known not to be accessed can be defined as cold data and stored on object storage. Such data is not cached in local storage, which avoids occupying cache space. Caching hot data is a method for optimizing storage costs and database performance. By default, the system dynamically caches hot data (frequently accessed data) and evicts cold data (infrequently accessed data) based on the data access frequency and data generation time. However, for query-sensitive businesses, automatic identification of hot and cold data is unpredictable and may cause response time (RT) jitter during queries.
For business scenarios with clear hot and cold data patterns, such as time-series applications, you can customize the hot/cold storage policy. You can directly define the scope of hot data based on business characteristics, such as time boundaries, to overcome the limitations of automatic hot/cold identification and improve performance predictability. By caching hot business data in local storage in advance, you can avoid RT jitter during queries.
Scenarios
- Time-sensitive businesses: For example, businesses that only need to view recent data.
- Businesses that require high RT stability: Businesses that are sensitive to the query latency of frequently accessed data within a specific range.
Data caching mechanism
Data attribute types:
HOT: The data is hot and is cached locally whenever possible. If local storage capacity permits, all hot data is cached locally.AUTO: The system automatically identifies data as hot or cold based on access frequency and dynamically prefetches and caches it.COLD: The data is cold data and will not be cached to the local cache disk. For data already persisted to the cache, cache eviction is actively triggered. Subsequent accesses to the table data can be stored in the macroblock memory cache and will not be persisted to the macroblock cache.NONE: Inherits the hot/cold caching policy from its parent entity (for example, a primary table). If an index table's caching policy is set toNONE, it dynamically inherits the primary table's policy.Note
The hot/cold storage policy inherits the
STORAGE_CACHE_POLICYvalue of its parent. The parent of a subpartition is the partition, the parent of a partition is the table level, and the parent of an index table is the primary table.
Priority mechanism:
- User-specified hot data takes precedence over automatically identified hot data.
Support for hot/cold storage policies
OceanBase AI Database supports customizing hot/cold storage policies by using SQL statements:
- Supports specifying table-level and partition-level hot/cold storage policies (
STORAGE_CACHE_POLICY) when you create tables (user tables and index tables). - Supports modifying table-level and partition-level hot/cold storage policies (
STORAGE_CACHE_POLICY) of tables (user tables and index tables).
- Supports specifying table-level and partition-level hot/cold storage policies (
OceanBase AI Database provides parameters to configure global hot/cold storage policies:
- The default_storage_cache_policy parameter configures the default caching policy.
- The enable_manual_storage_cache_policy parameter enables user-defined hot/cold storage policies.
- The suspend_storage_cache_task parameter specifies whether to suspend background cache tasks.
OceanBase AI Database provides views to query caching policies:
- The V$OB_TABLET_LOCAL_CACHE view displays the overall caching status of each tenant on the current OBServer node.
- The V$OB_STORAGE_CACHE_TASKS view displays the cache task information of each tenant on the current OBServer node.