Cache size

2025-07-02 07:30:55  Updated

This topic describes monitoring metrics related to the cache size within an OceanBase Database tenant. You can specify a statistical range to query statistics about the cache size in a single zone or on a single OBServer of an OceanBase Database tenant.

block_cache

Definition

The block cache size in the specified statistical range.

A block cache is similar to a buffer cache in Oracle Database and is used to store data blocks. To be specific, a block cache stores decompressed microblocks whose sizes swell after decompression.

Description

Metric Metric name Unit
block_cache block_cache_size MB

Calculation expression

sum(ob_cache_size_bytes{cache_name="user_block_cache",@LABELS}) by (@GBLABELS)

SQL statements for metric collection

  • If you use OceanBase Database of a version earlier than V4.0, execute the following statement:

    select /*+ MONITOR_AGENT READ_CONSISTENCY(WEAK) */ tenant_id, cache_name, cache_size from __all_virtual_kvcache_info where svr_ip = ? and svr_port = ?
    
  • If you use OceanBase Database V4.0 or later, execute the following statement:

    select /* MONITOR_AGENT */ tenant_id, cache_name, cache_size from GV$OB_KVCACHE where svr_ip = ? and svr_port = ?
    

row_cache

Definition

The row cache size in the specified statistical range.

A row cache stores data rows. After you call the Get or MultiGet method, the data rows returned may be stored in a row cache. This greatly facilitates the query of frequently queried rows, thus significantly improving the query performance.

Description

Metric Metric name Unit
row_cache row_cache_size MB

Calculation expression

sum(ob_sysstat{stat_id="120008",@LABELS}) by (@GBLABELS)

SQL statements for metric collection

  • If you use OceanBase Database of a version earlier than V4.0, execute the following statement:

    select /*+ MONITOR_AGENT READ_CONSISTENCY(WEAK) */ con_id tenant_id, stat_id, value from v$sysstat where stat_id IN (120008) and (con_id > 1000 or con_id = 1) and class < 1000
    
  • If you use OceanBase Database V4.0 or later, execute the following statement:

    select /* MONITOR_AGENT */ con_id tenant_id, stat_id, value from v$sysstat where stat_id IN (120008) and (con_id > 1000 or con_id = 1) and class < 1000
    

plan_cache

Definition

The plan cache size in the specified statistical range.

Description

Metric Metric name Unit
plan_cache plan_cache_size MB

Calculation expression

sum(ob_plan_cache_memory_bytes{@LABELS}) by (@GBLABELS)

SQL statements for metric collection

  • If you use OceanBase Database of a version earlier than V4.0, execute the following statement:

    select /*+ MONITOR_AGENT READ_CONSISTENCY(WEAK) */ tenant_id, mem_used, access_count, hit_count from v$plan_cache_stat
    
  • If you use OceanBase Database V4.0 or later, execute the following statement:

    select /* MONITOR_AGENT */ tenant_id, mem_used, access_count, hit_count from V$OB_PLAN_CACHE_STAT
    

clog_cache

Definition

The clog cache size in the specified statistical range.

Description

Metric Metric name Unit
clog_cache clog_cache_size MB

Calculation expression

sum(ob_sysstat{stat_id="120001",@LABELS}) by (@GBLABELS)

SQL statements for metric collection

  • If you use OceanBase Database of a version earlier than V4.0, execute the following statement:

    select /*+ MONITOR_AGENT READ_CONSISTENCY(WEAK) */ con_id tenant_id, stat_id, value from v$sysstat where stat_id IN (120001) and (con_id > 1000 or con_id = 1) and class < 1000
    
  • If you use OceanBase Database V4.0 or later, execute the following statement:

    select /* MONITOR_AGENT */ con_id tenant_id, stat_id, value from v$sysstat where stat_id IN (120001) and (con_id > 1000 or con_id = 1) and class < 1000
    

bloomfilter_cache

Definition

The Bloomfilter cache size in the specified statistical range.

Description

Metric Metric name Unit
bloomfilter_cache bloom_filter_cache_size MB

Calculation expression

sum(ob_sysstat{stat_id="120009",@LABELS}) by (@GBLABELS)

SQL statements for metric collection

  • If you use OceanBase Database of a version earlier than V4.0, execute the following statement:

    select /*+ MONITOR_AGENT READ_CONSISTENCY(WEAK) */ con_id tenant_id, stat_id, value from v$sysstat where stat_id IN (120009) and (con_id > 1000 or con_id = 1) and class < 1000
    
  • If you use OceanBase Database V4.0 or later, execute the following statement:

    select /* MONITOR_AGENT */ con_id tenant_id, stat_id, value from v$sysstat where stat_id IN (120009) and (con_id > 1000 or con_id = 1) and class < 1000
    

location_cache

Definition

The location cache size in the specified statistical range.

Description

Metric Metric name Unit
location_cache location_cache_size MB

Calculation expression

sum(ob_sysstat{stat_id="120000",@LABELS}) by (@GBLABELS)

SQL statements for metric collection

  • If you use OceanBase Database of a version earlier than V4.0, execute the following statement:

    select /*+ MONITOR_AGENT READ_CONSISTENCY(WEAK) */ con_id tenant_id, stat_id, value from v$sysstat where stat_id IN (120000) and (con_id > 1000 or con_id = 1) and class < 1000
    
  • If you use OceanBase Database V4.0 or later, execute the following statement:

    select /* MONITOR_AGENT */ con_id tenant_id, stat_id, value from v$sysstat where stat_id IN (120000) and (con_id > 1000 or con_id = 1) and class < 1000
    

Contact Us