Note
This view is available starting with V4.6.3.
Overview
This view displays the macroblock cache statistics for each tenant's tablets on all OBServer nodes. Each row corresponds to a tablet on an OBServer node, showing the total number of macroblocks in the current version, the number of cached macroblocks, the actual data size of the macroblocks, the data size of the cached macroblocks, and the cache ratio. It can be used to check whether the data for a specified table or tablet has been fully cached.
Notice
To query this view, you must specify either TABLE_ID or TABLET_ID. A full-table scan without a range is not supported when neither parameter is specified.
Columns
Field Name |
Type |
Whether can be NULL |
Description |
|---|---|---|---|
| SVR_IP | varchar(46) | NO | The IP address of the OBServer node. |
| SVR_PORT | bigint(20) | NO | The port number of the OBServer node. |
| TENANT_ID | bigint(20) | NO | Tenant ID. |
| LS_ID | bigint(20) | NO | The ID of the log stream to which the tablet currently belongs. |
| TABLET_ID | bigint(20) | NO | Tablet ID. |
| TRANSFER_SCN | bigint(20) | NO | The transfer SCN (transfer version number) of the tablet. |
| TABLE_ID | bigint(20) | NO | The table ID to which the tablet belongs. |
| STORAGE_CACHE_POLICY | varchar(64) | NO | The current hot/cold status of the tablet. Valid values are the same as those of GV$OB_TABLET_LOCAL_CACHE in the STORAGE_CACHE_POLICY Consistent, including AUTO (Automatic identification of hot and cold data) and HOT (Hot data). |
| MACRO_BLOCK_COUNT | bigint(20) | NO | Total number of macroblocks in the current version of the tablet. |
| CACHED_MACRO_BLOCK_COUNT | bigint(20) | NO | The number of macroblocks cached in the current version of the tablet. |
| MACRO_BLOCK_REQUIRED_SIZE | bigint(20) | NO | The actual data size of the macroblock corresponding to the current tablet version, in bytes. |
| CACHED_MACRO_BLOCK_REQUIRED_SIZE | bigint(20) | NO | The actual data size of the macroblock cached in the current version's macroblock, in bytes. |
| CACHE_RATIO_PERCENT | bigint(20) | NO | The percentage of cached macroblocks in the total number of macroblocks in the current version of the Tablet. |
| INFO | varchar(1024) | NO | Other diagnostic information. |
Usage instructions
The statistics scope of this view is all OBServer nodes. When a user queries, only data of the current tenant is displayed.
To generate statistics for each row, the system must retrieve the current tablet, load and traverse its macroblock information, deduplicate by
MacroBlockId, and query the macroblock cache metadata of this node one by one. Therefore, during queries, you should try to narrow down the scope usingTABLE_IDorTABLET_IDto avoid querying a large number of tablets at once.In the case of a fork table, one macroblock may be shared by multiple tablets. When troubleshooting cache issues, you should consider the values of
TABLET_ID,TABLE_ID, andSTORAGE_CACHE_POLICYtogether.
Sample query
Query the macroblock cache status of each tablet in a specified table.
SELECT SVR_IP, SVR_PORT, TENANT_ID, TABLE_ID, TABLET_ID, STORAGE_CACHE_POLICY, MACRO_BLOCK_COUNT, CACHED_MACRO_BLOCK_COUNT, CACHE_RATIO_PERCENT FROM oceanbase.GV$OB_TABLET_MACRO_CACHE_STAT WHERE TABLE_ID = 500001;Query the macroblock cache status of a specified tablet.
SELECT * FROM oceanbase.GV$OB_TABLET_MACRO_CACHE_STAT WHERE TABLET_ID = 200001;