Note
- This view was renamed from
GV$MEMORYtoGV$OB_MEMORYstarting from V4.0.0. In V4.0.0 and later, you must use the new view nameGV$OB_MEMORYto query. Using the old view nameGV$MEMORYwill result in an error. - MysqlRequesReco: MySQL request record module
- LogAggreBuffer: log aggregation buffer module
- PartitLogServic: partition log service module
- SqlDtl: SQL detail module
- TransAudit: transaction audit module
- IoControl: I/O control module
- ResultSet: query result set module
- SchemaSysCache: system-level cache module for caching schema information
- SeArray: sortable array module
- SstaMicrBlocAll: statistics, microblock, and other modules
- CsSstableReader: compressed table reader
- TmpBlockManager: temporary block manager
- TenantSchemMgr: tenant schema manager
- DecoderCtx: decoder context
- SqlSqcHandler: SQL semantic processor
- CostBasedRewrit: cost-based rewrite optimizer
- SqlExecutor: SQL executor
- SqlPsCache: SQL parameter cache module
- OB_SQL_AGGR_FUNC_ROW: SQL aggregate function row object
- SqlAggrFuncRow: SQL aggregate function row object
- WindowAggProc: window aggregation processing module
- SqLWindoRowStor: module for storing window rows
- SqLChunkRowStor: module for storing block rows
- SqLTempTabLeRow: module for storing temporary table rows
- ConnectByPump: data transmission module for connection operations
- SqlSortRow: row module for sorting
- SortOpRows: collection of sorted row objects
- SqLHashDisRowSt: hash-distributed row storage module
- SqLHashDist: hash distribution module
- HashNodeGrouRow: hash node grouping row module
- HashDistinctOp: hash deduplication operation module
- ArenaHashJoin: memory space management module for hash join operations
- HtOpAlloc: hash table operation allocation module
- OB_SQL_PHY_PLAN: query plan module
- OB_SQL_PLAN_CACHE: query plan cache module
- OB_SQL_PHY_PL_OBJ: query plan object module
- PRE_CALC_EXPR: module for pre-calculated expressions
- PartTranCtxMgr: partition transaction context
- TenantCtxAlloca: tenant allocation context
- Partition: partition object
- PartitioStore: partition storage module
- PartitioStorage: partition storage
- Sstable: SSTable table
- SstableMeta: Meta tenant SSTable table
- MemtableObject: memory table object
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 for PLAN_CACHE_CTX_ID, MEMSTORE_CTX_ID, and DEFAULT_CTX_ID.
Aggregating large amounts of data (SUM, AVG, MAX, MIN, etc.): Aggregation operations require loading data into memory for calculations, which may lead to an increase in memory usage for PLAN_CACHE_CTX_ID, MEMSTORE_CTX_ID, and DEFAULT_CTX_ID.
Joining large amounts of data (JOIN): Join operations require loading data into memory for matching, which may lead to an increase in memory usage for PLAN_CACHE_CTX_ID, MEMSTORE_CTX_ID, and DEFAULT_CTX_ID.
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 for PLAN_CACHE_CTX_ID, MEMSTORE_CTX_ID, and DEFAULT_CTX_ID.
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 for TRANS_CTX_MGR_ID, MEMSTORE_CTX_ID, and DEFAULT_CTX_ID.
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 for TRANS_CTX_MGR_ID, DEFAULT_CTX_ID, LOB_CTX_ID, and TX_DATA_TABLE.
Purpose
The GV$OB_MEMORY view displays the memory statistics for the current tenant on all nodes.
Columns
| Column | Type | Nullable | Description |
|---|---|---|---|
| TENANT_ID | bigint(20) | NO | The tenant ID. |
| 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 CTX to which the memory belongs. |
| MOD_NAME | varchar(256) | NO | The name of the Mod to which the memory belongs. |
| COUNT | decimal(20,0) | NO | The difference between the memory allocated and released, which indicates the number of memory units currently used by the Mod. |
| HOLD | decimal(20,0) | NO | The size of memory currently occupied by the Mod. |
| USED | decimal(20,0) | NO | The size 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 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 dynamic 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 partial modifications during transaction execution. When a transaction is committed or rolled back, the corresponding data can be found and operated on. |
| 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. It stores the status of resolved transactions and is used for dumping queries in scenarios such as uncommitted transactions and FAST COMMIT. |
| 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 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 for the CTX. The following are some common SQL operations that may cause an increase in memory usage for certain CTXs:
Sample query
A user tenant queries the memory statistics of all nodes in the tenant and displays the first 10 records.
obclient [oceanbase]> SELECT * FROM oceanbase.GV$OB_MEMORY LIMIT 10;
The query result is as follows:
+-----------+----------------+----------+----------------+-----------------+-------+-----------+-----------+
| TENANT_ID | SVR_IP | SVR_PORT | CTX_NAME | MOD_NAME | COUNT | HOLD | USED |
+-----------+----------------+----------+----------------+-----------------+-------+-----------+-----------+
| 1002 | 172.xx.xxx.xxx | 2882 | CO_STACK | CoStack | 196 | 101154816 | 100966656 |
| 1002 | 172.xx.xxx.xxx | 2882 | CO_STACK | KvstorCacheMb | 0 | 0 | 0 |
| 1002 | 172.xx.xxx.xxx | 2882 | DEFAULT_CTX_ID | ApplySrv | 1 | 409600 | 401408 |
| 1002 | 172.xx.xxx.xxx | 2882 | DEFAULT_CTX_ID | APPLY_STATUS | 1 | 8128 | 7936 |
| 1002 | 172.xx.xxx.xxx | 2882 | DEFAULT_CTX_ID | ArcFetchQueue | 1 | 8540160 | 8519680 |
| 1002 | 172.xx.xxx.xxx | 2882 | DEFAULT_CTX_ID | ArcSenderQueue | 1 | 933888 | 931072 |
| 1002 | 172.xx.xxx.xxx | 2882 | DEFAULT_CTX_ID | AsyncFreezeTabl | 1 | 114688 | 111096 |
| 1002 | 172.xx.xxx.xxx | 2882 | DEFAULT_CTX_ID | Autoincrement | 1 | 40960 | 37032 |
| 1002 | 172.xx.xxx.xxx | 2882 | DEFAULT_CTX_ID | Backup | 1 | 16384 | 12344 |
| 1002 | 172.xx.xxx.xxx | 2882 | DEFAULT_CTX_ID | BackupIOPerMgr | 1 | 1152 | 960 |
+-----------+----------------+----------+----------------+-----------------+-------+-----------+-----------+
10 rows in set