Note
The view name is changed from V$MEMORY to V$OB_MEMORY since OceanBase Database V4.0.0.
Purpose
The V$OB_MEMORY view displays the tenant-level memory statistics.
Columns
| Column | Type | Nullable? | Description |
|---|---|---|---|
| TENANT_ID | bigint(20) | NO | The ID of the tenant. |
| SVR_IP | varchar(46) | NO | The IP address of the server. |
| SVR_PORT | bigint(20) | NO | The port number of the server. |
| CTX_NAME | varchar(256) | NO | The name of the context to which the memory belongs. |
| MOD_NAME | varchar(256) | NO | The name of the module to which the memory belongs. |
| COUNT | decimal(20,0) | NO | The difference between memory spaces that are allocated and released. That is, the number of memory units used by the module. |
| HOLD | decimal(20,0) | NO | The memory size currently occupied by the module. |
| USED | decimal(20,0) | NO | The size in bytes of memory being used by the module. |
Values of the CTX_NAME column
The following table lists the names and meanings of general memory contexts.
| 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 a 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 |
|
ALL |
|
500 | |
| SQL_EXEC_CTX_ID |
|
ALL |
| WORK_AREA |
|
|
| PLAN_CACHE_CTX_ID |
|
|
| TRANS_CTX_MGR_ID |
|
|
| 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 |
|
|
| STORAGE_SHORT_TERM_META_CTX_ID |
|
|
| ALL | OB_COMMON_ARRAY: the common array in OceanBase Database. | ALL |
Impact of general 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 BYorGROUP BYclause: A sorting operation needs to load the data to the memory for sorting. This may cause an increase in the memory usage ofPLAN_CACHE_CTX_ID,MEMSTORE_CTX_ID, andDEFAULT_CTX_ID.Aggregation of a large amount of data by using the
SUM,AVG,MAX, orMINfunction: An aggregation operation needs to load the data to the memory for computing. This may cause an increase in the memory usage ofPLAN_CACHE_CTX_ID,MEMSTORE_CTX_ID, andDEFAULT_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, andDEFAULT_CTX_ID.Query of a large amount of data by using the
SELECTstatement: A query operation needs to load the data to the memory for filtering and sorting. This may cause an increase in the memory usage ofPLAN_CACHE_CTX_ID,MEMSTORE_CTX_ID, andDEFAULT_CTX_ID.Write of a large amount of data by using the
INSERT,UPDATE, orDELETEstatement: A write operation requires transaction management and processing. This may cause an increase in the memory usage ofTRANS_CTX_MGR_ID,MEMSTORE_CTX_ID, andDEFAULT_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, andTX_DATA_TABLE.