V$OB_MEMORY

2025-12-03 06:33:12  Updated

Note

  • The view name is changed from V$MEMORY to V$OB_MEMORY since OceanBase Database V4.0.0.
  • This view is supported only in MySQL mode. The query result is an empty set in Oracle mode.

Purpose

The V$OB_MEMORY view displays the memory statistics of the current tenant on the current node.

Columns

Column Type Nullable? Description
CON_ID NUMBER(38) NO The ID of the tenant.
SVR_IP VARCHAR2(46) NO The IP address of the OBServer node.
SVR_PORT NUMBER(38) NO The port number of the OBServer node.
CTX_NAME VARCHAR2(256) NO The name of the context to which the memory belongs.
MOD_NAME VARCHAR2(256) NO The name of the module to which the memory belongs.
COUNT NUMBER NO The difference between memory spaces that are allocated and released, which is the number of memory units used by the module.
HOLD NUMBER NO The size of memory currently occupied by the module.
USED NUMBER NO The size in bytes of memory being used by the module.

Values of the CTX_NAME column

The following table describes the common memory context names.

CTX_NAME Description
DEFAULT_CTX_ID The context ID of unallocated memory.
MEMSTORE_CTX_ID The MemTable data context ID.
TRANS_CTX_MGR_ID The transaction context ID.
PLAN_CACHE_CTX_ID The context ID of the plan cache.
GLIBC The memory applied for by using the Glibc Malloc API.
CO_STACK The memory for the execution stack of threads.
KVSTORE_CACHE_ID The ID of the auto-scaling cache.
META_OBJ_CTX_ID The memory that stores metadata, such as metadata of macroblocks.
TX_CALLBACK_CTX_ID The ID of the transaction callback context. This context records some modifications made during transaction execution so that the required data can be located when the transaction is committed or rolled back.
LOB_CTX_ID The allocator ID in ObLobManager.
PS_CACHE_CTX_ID The cache ID of the PREPARE stmt_name FROM preparable_stmt statement.
TX_DATA_TABLE The transaction data table. This table stores the status of committed or rolled back transactions and is used in scenarios such as minor compaction of status information of uncommitted transactions and fast commits.
MDS_DATA_ID The memory ID of multi-source data.
LIBEASY The network framework memory (EASY).
LOGGER_CTX_ID The context ID of the memory for application logs.
RPC_CTX_ID The context ID of the memory for the RPC framework.
PKT_NIO The network framework memory (pkt_nio).
SCHEMA_SERVICE The memory for schema metadata, such as tables and databases.

Mappings between CTX_NAME and MOD_NAME

The following table lists the mappings between CTX_NAME and MOD_NAME.

CTX_NAME MOD_NAME TENANT
DEFAULT_CTX_ID
  • MysqlRequesReco: the module for recording MySQL requests.
  • LogAggreBuffer: the buffer module for log aggregation.
  • PartitLogServic: the partition log service module.
  • SqlDtl: the SQL details module.
  • TransAudit: the transaction audit module.
  • IoControl: the input/output control module.
  • ResultSet: the module where result sets are located.
ALL
  • SchemaSysCache: the system-level cache module that caches mode information.
  • SeArray: the array sorting module.
  • SstaMicrBlocAll: the module for storing statistics and microblocks.
  • CsSstableReader: the compressed table reader.
  • TmpBlockManager: the temporary block manager.
  • TenantSchemMgr: the tenant mode manager.
  • DecoderCtx: the decoder context.
  • SqlSqcHandler: the SQL semantics handler.
500
SQL_EXEC_CTX_ID
  • CostBasedRewrit: the cost-based rewrite optimizer.
  • SqlExecutor: the SQL executor.
  • SqlPsCache: the SQL parameter cache module.
  • OB_SQL_AGGR_FUNC_ROW: a row object for SQL aggregate functions.
ALL
WORK_AREA
  • SqlAggrFuncRow: a row object for SQL aggregate functions.
  • WindowAggProc: the window aggregation processing module.
  • SqLWindoRowStor: the module related to rows in the storage window.
  • SqLChunkRowStor: the module related to rows in storage blocks.
  • SqLTempTabLeRow: the module related to rows in temporary tables.
  • ConnectByPump: the data transmission module for connections.
  • SqlSortRow: the row sorting module.
  • SortOpRows: the row object collection sorting module.
  • SqLHashDisRowSt: the module for storing hash-distributed rows.
  • SqLHashDist: the hash distribution module.
  • HashNodeGrouRow: the grouping and row dividing module for hash nodes.
  • HashDistinctOp: the hash deduplication module.
  • ArenaHashJoin: the memory space management module for hash joins.
  • HtOpAlloc: the hash table operation allocation module.
PLAN_CACHE_CTX_ID
  • OB_SQL_PHY_PLAN: the execution plan module.
  • OB_SQL_PLAN_CACHE: the module that caches execution plans.
  • OB_SQL_PHY_PL_OBJ: the execution plan object module.
  • PRE_CALC_EXPR: the module related to precomputation expressions.
TRANS_CTX_MGR_ID
  • PartTranCtxMgr: the partition transaction context.
  • TenantCtxAlloca: the tenant allocation context.
TX_CALLBACK_CTX_ID MemtableCallbac: the module related to callbacks of memory tables.
REPLAY_STATUS_CTX_ID ReplayStatus: the module related to the replay status.
CO_STACK CO_STACK: the module related to the coroutine stack. 500
STORAGE_LONG_TERM_META_CTX_ID
  • Partition: a partition object.
  • PartitioStore: the partition store module.
  • PartitioStorage: the partition storage.
STORAGE_SHORT_TERM_META_CTX_ID
  • Sstable: an SSTable.
  • SstableMeta: the SSTable of a meta tenant.
  • MemtableObject: the memory table object.
ALL OB_COMMON_ARRAY: the common array in OceanBase Database. ALL

Impact of common SQL operations on the memory context

In OceanBase Database, each SQL execution or operation corresponds to a context. The memory usage varies based on the memory context used, depending on the data volume and operation complexity. The following general SQL executions or operations may cause the increase in memory usage of some contexts.

  • Sorting of a large amount of data by using the ORDER BY or GROUP BY clause: A sorting operation needs to load the data to the memory for sorting. This may cause an increase in the memory usage of PLAN_CACHE_CTX_ID, MEMSTORE_CTX_ID, and DEFAULT_CTX_ID.

  • Aggregation of a large amount of data by using the SUM, AVG, MAX, or MIN function: An aggregation operation needs to load the data to the memory for computing. This may cause an increase in the memory usage of PLAN_CACHE_CTX_ID, MEMSTORE_CTX_ID, and DEFAULT_CTX_ID.

  • Join of a large amount of data by using JOIN operations: A join operation needs to load the data to the memory for matching. This may cause an increase in the memory usage of PLAN_CACHE_CTX_ID, MEMSTORE_CTX_ID, and DEFAULT_CTX_ID.

  • Query of a large amount of data by using the SELECT statement: A query operation needs to load the data to the memory for filtering and sorting. This may cause an increase in the memory usage of PLAN_CACHE_CTX_ID, MEMSTORE_CTX_ID, and DEFAULT_CTX_ID.

  • Write of a large amount of data by using the INSERT, UPDATE, or DELETE statement: A write operation requires transaction management and processing. This may cause an increase in the memory usage of TRANS_CTX_MGR_ID, MEMSTORE_CTX_ID, and DEFAULT_CTX_ID.

  • Logging of a large amount of data into the REDO log, UNDO log, or binlog: A logging operation needs to load the data to the memory. This may cause an increase in the memory usage of TRANS_CTX_MGR_ID, DEFAULT_CTX_ID, LOB_CTX_ID, and TX_DATA_TABLE.

References

Contact Us