Note
This view is available starting with V4.6.3.
Overview
This view displays the number of shared data GC-deleted macroblocks per tenant per day, categorized by storage type. The view groups the statistics by the natural day of the GMT time zone corresponding to the GMT_CREATE column and by storage type. It is available only to the sys tenant.
This view only queries the two types of statistics records: MARK_SWEEP_GC_IN_TABLE_STAT and MARK_SWEEP_GC_OBJECT_STORAGE_STAT. It does not read or deserialize the original MacroBlockID lists in the MARK_SWEEP_GC records, thereby avoiding query timeouts when querying across all tenants due to the expansion of a large number of MacroBlockIDs.
Columns
Field Name |
Type |
Whether can be NULL |
Description |
|---|---|---|---|
| TENANT_ID | bigint(20) | NO | Tenant ID. |
| STAT_DATE | date | NO | Statistics Records GMT_CREATE The GMT natural day to which it belongs. |
| GC_TYPE | varchar(128) | NO | GC type. This parameter is fixed in this issue and returns MARK_SWEEP_GC. |
| STORAGE_TYPE | varchar(32) | NO | Storage type:
|
| DELETED_MACRO_BLOCK_COUNT | bigint(20) | NO | The number of MacroBlockIDs that completed the deletion process for that storage type on the day. |
| DELETED_MACRO_BLOCK_SIZE | bigint(20) | YES | Total size of deleted macroblocks, in bytes. This field is reserved and always returns a fixed value. NULL. |
Usage instructions
The value of
DELETED_MACRO_BLOCK_COUNTis the cumulative sum of theVALUEfields in the statistics records, that is,SUM(CAST(VALUE AS UNSIGNED)), not the count of statistics recordsCOUNT(*).The mapping between
STORAGE_TYPEand internal statistics types is as follows:Internal statistics typeViewSTORAGE_TYPEMARK_SWEEP_GC_IN_TABLE_STATIN_TABLEMARK_SWEEP_GC_OBJECT_STORAGE_STATOBJECT_STORAGEDELETED_MACRO_BLOCK_SIZEreturnsNULLinstead of0in this version to prevent users from mistakenly assuming the deleted size is 0.STAT_DATE: counts by natural day in GMT.
Sample query
Query the number of macroblocks deleted by GC for shared data per storage type in a day for the tenant with ID 1002.
SELECT *
FROM oceanbase.CDB_OB_SHARED_MACRO_BLOCK_GC_STAT
WHERE TENANT_ID = 1002
ORDER BY STAT_DATE, STORAGE_TYPE;
The query result is as follows:
+-----------+------------+---------------+----------------+---------------------------+--------------------------+
| TENANT_ID | STAT_DATE | GC_TYPE | STORAGE_TYPE | DELETED_MACRO_BLOCK_COUNT | DELETED_MACRO_BLOCK_SIZE |
+-----------+------------+---------------+----------------+---------------------------+--------------------------+
| 1002 | 2026-08-18 | MARK_SWEEP_GC | IN_TABLE | 120 | NULL |
| 1002 | 2026-08-18 | MARK_SWEEP_GC | OBJECT_STORAGE | 380 | NULL |
+-----------+------------+---------------+----------------+---------------------------+--------------------------+
2 rows in set
References
DBA_OB_SHARED_MACRO_BLOCK_GC_STAT: Visible to user tenants, displays the statistics on shared data GC macroblock deletions for the current tenant.