OceanBase Database classifies the internal memory of each tenant into two parts:
Non-auto-scaling memory
Auto-scaling memory (KVCache)
The non-auto scaling memory is mainly used by MemStore to store incremental data. The auto-scaling memory is mainly managed by KVCache, which includes components such as row_cache, schema_cache, and clog_cache. The auto-scaling KVCache will try to use all the memory available to the tenant except for the non-auto scaling portion.
In addition, there are many other memory components that occupy a certain amount of memory, including plan caches (execution plan caches), SQL areas (memory for SQL execution), and election actions. You can query __all_virtual_memory_info to obtain information about the usage of all memory components.

Manage non-auto-scaling memory
memstore_limit_percentage is the only parameter related to the non-auto-scaling memory. It specifies the maximum percentage of MaxMemory of the tenant for MemStore. The default value is 50%.
Data writes and updates in the tenant will increase the MemStore usage. When the MemStore usage reaches the upper limit, subsequent write or update operations will be denied.
To release the memory, OceanBase Database performs minor compactions or major compactions based on the percentage of the memory occupied by the MemStore. When the percentage of the memory occupied by the MemStore reaches the value of freeze_trigger_percentage, a freeze (an action performed prior to minor compaction or major compaction) is performed. The default value is 70% of the upper limit of the tenant memory available for MemStore, which is also 35% of MaxMemory of the tenant.
Note
MaxMemory and MinMemory are upper and lower limits of the memory available for a tenant. You can specify the parameters as needed.
Manage auto-scaling memory
KVCache is the main part of the auto-scaling memory. OceanBase Database manages most caches in the key-value (KV) format in KVCache. KVCache supports auto-scaling, priority control for different cache types, and intelligent eviction mechanisms.
Generally, you do not need to configure KVCache. In special scenarios, you can set the priorities for different cache types. Data of a cache type with a higher priority is more likely to be retained in the cache than data of a cache type with a lower priority.
The following table describes the parameters for controlling the priorities of different cache types. A greater value indicates a higher priority.
| Parameter | Description |
|---|---|
| fuse_row_cache_priority | The priority of the fuse row cache in the cache system. |
| location_cache_priority | The priority of the location cache in the cache system. |
| clog_cache_priority | The caching priority of transaction logs. |
| index_clog_cache_priority | The priority of the transaction log index in the cache system. |
| user_tab_col_stat_cache_priority | The priority of the statistics cache in the cache system. |
| index_cache_priority | The priority of the index in the cache system. |
| index_info_block_cache_priority | The priority of the block index in the cache system. |
| user_block_cache_priority | The priority of the data block cache in the cache system. |
| user_row_cache_priority | The priority of the data row cache in the cache system. |
| bf_cache_priority | The priority of the bloom filter cache. |
You can query the __all_virtual_kvcache_info parameter to obtain the information about the sub caches in KVCache. The sub caches of a sys tenant are slightly different from those of a user tenant.
The following table describes the cache types of the
systenant.Cache type Description schema_cache Stores the schema information of users and provides the metadata of database objects for the normal running of SQL statements and the system. location_cache Stores the location information of partitions. You can query the cache for OBServer nodes on which a partition is located. block_index_cache Caches microblock indexes to speed up access to microblock data. user_block_cache Caches microblock data. Microblocks can be compressed by using compression algorithms. To speed up queries, this cache caches decompressed microblock data. fuse_row_cache Caches row snapshot data to speed up point queries and prevent cache failures caused by minor compactions or major compactions. index_clog_cache Caches the content of ilog files to minimize the overheads for reading ilog files. user_tab_col_stat_cache Caches the column statistics of the user table for calculating the costs of executing SQL statements. user_table_stat_cache Caches the user table statistics for calculating the costs of executing SQL statements. The following table describes the cache types of a user tenant.
Cache type Description user_block_cache Caches microblock data. Microblocks can be compressed by using compression algorithms. To speed up queries, this cache caches decompressed microblock data. block_index_cache Caches microblock indexes to speed up access to microblock data. fuse_row_cache Caches row snapshot data to speed up point queries and prevent cache failures caused by minor compactions or major compactions.