Note
- This view was renamed from V$MEMORY to V$OB_MEMORY starting from V4.0.0.
- This view is only available in MySQL-compatible mode. In Oracle-compatible mode, the query result is empty.
Purpose
This view displays the memory statistics of the current tenant on the current node.
Columns
| Column | Type | Nullable | Description |
|---|---|---|---|
| CON_ID | NUMBER(38) | NO | The tenant ID. |
| SVR_IP | VARCHAR2(46) | NO | The IP address of the server. |
| SVR_PORT | NUMBER(38) | NO | The port number of the server. |
| CTX_NAME | VARCHAR2(256) | NO | The name of the CTX to which the memory belongs. |
| MOD_NAME | VARCHAR2(256) | NO | The name of the MOD to which the memory belongs. |
| COUNT | NUMBER | NO | The difference between the number of memory units allocated and freed. This value indicates the number of memory units currently used by the MOD. |
| HOLD | NUMBER | NO | The amount of memory currently occupied by the MOD, in bytes. |
| USED | NUMBER | NO | The amount of memory currently used by the MOD, in bytes. |
CTX_NAME values
The following table describes the names and meanings of common memory CTXs.
| CTX_NAME | Description |
|---|---|
| DEFAULT_CTX_ID | The ID of the unallocated memory set context. |
| MEMSTORE_CTX_ID | The ID of the user MemTable data context. |
| TRANS_CTX_MGR_ID | The ID of the transaction context. |
| PLAN_CACHE_CTX_ID | The ID of the execution plan cache context. |
| GLIBC | The memory allocated by using the Glibc Malloc interface. |
| CO_STACK | The memory of the thread execution stack. |
| KVSTORE_CACHE_ID | The ID of the dynamically scalable cache. |
| META_OBJ_CTX_ID | The memory of the stored metadata, such as macroblock metadata. |
| TX_CALLBACK_CTX_ID | The ID of the transaction callback context. This context is used to record some modifications during transaction execution. When a transaction is committed or rolled back, the corresponding data can be found and processed. |
| LOB_CTX_ID | The Allocator ID in the 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 resolved transactions and is used for queries in scenarios such as dumping uncommitted or FAST COMMIT transactions. |
| MDS_DATA_ID | The memory ID of multi-source data |
| LIBEASY | The memory of the network framework (EASY). |
| LOGGER_CTX_ID | The ID of the program log memory context. |
| RPC_CTX_ID | The ID of the RPC framework memory context. |
| PKT_NIO | The memory of the network framework (pkt_nio). |
| SCHEMA_SERVICE | The memory of the schema metadata, such as tables and databases. |
Correspondence between CTX_NAME and MOD_NAME
The following table lists the correspondence 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: Module for memory table callbacks | |
| REPLAY_STATUS_CTX_ID | ReplayStatus: Module for replay status | |
| CO_STACK | CO_STACK: Coroutine stack-related module | 500 |
| STORAGE_LONG_TERM_META_CTX_ID |
|
|
| STORAGE_SHORT_TERM_META_CTX_ID |
|
|
| ALL | OB_COMMON_ARRAY: OceanBase common array | ALL |
Impact of common SQL operations on memory CTX
In OceanBase Database, each SQL execution or operation corresponds to a specific CTX. The size of the data and the complexity of the operation can lead to an increase in memory usage. The following are some common SQL operations that may cause an increase in the memory usage of certain CTXs:
Sorting large amounts of data (ORDER BY, GROUP BY, etc.): Sorting operations require loading data into memory for sorting, which may lead to an increase in memory usage of the PLAN_CACHE_CTX_ID, MEMSTORE_CTX_ID, and DEFAULT_CTX_ID CTXs.
Aggregating large amounts of data (SUM, AVG, MAX, MIN, etc.): Aggregation operations require loading data into memory for calculation, which may lead to an increase in memory usage of the PLAN_CACHE_CTX_ID, MEMSTORE_CTX_ID, and DEFAULT_CTX_ID CTXs.
Joining large amounts of data (JOIN): Join operations require loading data into memory for matching, which may lead to an increase in memory usage of the PLAN_CACHE_CTX_ID, MEMSTORE_CTX_ID, and DEFAULT_CTX_ID CTXs.
Querying large amounts of data (SELECT): Query operations require loading data into memory for filtering and sorting, which may lead to an increase in memory usage of the PLAN_CACHE_CTX_ID, MEMSTORE_CTX_ID, and DEFAULT_CTX_ID CTXs.
Writing large amounts of data (INSERT, UPDATE, DELETE, etc.): Writing operations require managing and processing transactions, which may lead to an increase in memory usage of the TRANS_CTX_MGR_ID, MEMSTORE_CTX_ID, and DEFAULT_CTX_ID CTXs.
Logging large amounts of data (REDO, UNDO, BINLOG, etc.): Logging operations require loading data into memory for operations, which may lead to an increase in memory usage of the TRANS_CTX_MGR_ID, DEFAULT_CTX_ID, LOB_CTX_ID, and TX_DATA_TABLE CTXs.