After you initiate a major compaction, you can view the information about the major compaction in a view.
The duration of a major compaction depends on the data change between two major compactions. The longer the data change, the longer the duration of the major compaction. The number of major compaction threads and the cluster pressure during the major compaction also affect the duration of the major compaction.
View all major compactions of all tenants
As the system tenant, you can view the major compactions of all tenants by querying views.
Log in to the
systenant of the cluster as therootuser.Execute the following statements to view the major compactions.
Query the
CDB_OB_ZONE_MAJOR_COMPACTIONorCDB_OB_MAJOR_COMPACTIONview to view the major compactions of tenants.The
CDB_OB_ZONE_MAJOR_COMPACTIONview displays the major compactions of all tenants in each zone.obclient> SELECT * FROM oceanbase.CDB_OB_ZONE_MAJOR_COMPACTION;The query result is as follows:
+-----------+-------+---------------------+---------------------+----------------------------+----------------------------+--------+ | TENANT_ID | ZONE | BROADCAST_SCN | LAST_SCN | LAST_FINISH_TIME | START_TIME | STATUS | +-----------+-------+---------------------+---------------------+----------------------------+----------------------------+--------+ | 1 | zone1 | 1748368801021617000 | 1748368801021617000 | 2025-05-28 02:04:15.351286 | 2025-05-28 02:00:01.051592 | IDLE | | 1001 | zone1 | 1748368802924607000 | 1748368802924607000 | 2025-05-28 02:02:16.412661 | 2025-05-28 02:00:02.965810 | IDLE | | 1002 | zone1 | 1748368802035321000 | 1748368802035321000 | 2025-05-28 02:03:25.019173 | 2025-05-28 02:00:02.090687 | IDLE | | 1003 | zone1 | 1748368802977311000 | 1748368802977311000 | 2025-05-28 02:02:46.565036 | 2025-05-28 02:00:03.009192 | IDLE | | 1004 | zone1 | 1748368801786323000 | 1748368801786323000 | 2025-05-28 02:03:54.629630 | 2025-05-28 02:00:01.820863 | IDLE | +-----------+-------+---------------------+---------------------+----------------------------+----------------------------+--------+ 5 rows in setYou can view the
statuscolumn in the query result. The following table describes the related fields.Field Description TENANT_ID The ID of the tenant. ZONE The name of the zone. BROADCAST_SCN The version number of the major compaction that is broadcast. LAST_SCN The version number of the last major compaction. LAST_FINISH_TIME The end time of the last major compaction. START_TIME The start time of the major compaction. STATUS The status of the major compaction. Valid values: IDLE: The major compaction is not in progress.COMPACTING: The major compaction is in progress.VERIFYING: The checksum verification is in progress.
The
CDB_OB_ZONE_MAJOR_COMPACTIONview displays the global major compactions of all tenants.obclient> SELECT * FROM oceanbase.CDB_OB_MAJOR_COMPACTION;The query result is as follows:
+-----------+---------------------+----------------------------+----------------------+---------------------+----------------------------+----------------------------+------------+----------+--------------+------+--------+ | TENANT_ID | FROZEN_SCN | FROZEN_TIME | GLOBAL_BROADCAST_SCN | LAST_SCN | LAST_FINISH_TIME | START_TIME | STATUS | IS_ERROR | IS_SUSPENDED | INFO | MODE | +-----------+---------------------+----------------------------+----------------------+---------------------+----------------------------+----------------------------+------------+----------+--------------+------+--------+ | 1 | 1772992803755388000 | 2026-03-09 02:00:03.755388 | 1772992803755388000 | 1772992803755388000 | 2026-03-09 02:05:15.618392 | 2026-03-09 02:00:03.777269 | IDLE | NO | NO | | TENANT | | 1001 | 1772992803664660000 | 2026-03-09 02:00:03.664660 | 1772992803664660000 | 1772992803664660000 | 2026-03-09 02:05:15.692208 | 2026-03-09 02:00:03.682327 | IDLE | NO | NO | | TENANT | | 1002 | 1772992801519693000 | 2026-03-09 02:00:01.519693 | 1772992801519693000 | 1772992801519693000 | 2026-03-09 02:05:42.538179 | 2026-03-09 16:15:11.214954 | COMPACTING | NO | NO | | WINDOW | | 1003 | 1772992804311771000 | 2026-03-09 02:00:04.311771 | 1772992804311771000 | 1772992804311771000 | 2026-03-09 02:05:16.145435 | 2026-03-09 02:00:04.335287 | IDLE | NO | NO | | TENANT | | 1004 | 1772647200462679000 | 2026-03-05 02:00:00.462679 | 1772647200462679000 | 1772647200462679000 | 2026-03-05 02:05:31.394359 | 2026-03-05 02:00:00.480895 | IDLE | NO | NO | | TENANT | +-----------+---------------------+----------------------------+----------------------+---------------------+----------------------------+----------------------------+------------+----------+--------------+------+--------+ 5 rows in setYou can view the
statuscolumn in the query result. The following table describes the related fields.Field Description TENANT_ID The ID of the tenant. FROZEN_SCN The version number of the last major compaction. FROZEN_TIME The readable time corresponding to FROZEN_SCN.GLOBAL_BROADCAST_SCN The global version number of the major compaction that is broadcast. LAST_SCN The version number of the last major compaction that is completed. LAST_FINISH_TIME The end time of the last major compaction. START_TIME The start time of the major compaction. STATUS The status of the major compaction. Valid values: IDLE: The major compaction is not in progress.COMPACTING: The major compaction is in progress.VERIFYING: The checksum verification is in progress.
IS_ERROR YES: An error occurred during the major compaction.NO: No error occurred during the major compaction.
IS_SUSPENDED YES: The major compaction is suspended.NO: The major compaction is not suspended.
INFO The information about the major compaction. Mode The type of the daily major compaction. Valid values: TENANT: tenant-level major compactionWINDOW: window major compaction
Query the
GV$OB_MERGE_INFOorGV$OB_TABLET_COMPACTION_HISTORYview to view the major compactions of partitions.The
GV$OB_MERGE_INFOview displays the basic statistics of the major compactions of partitions.obclient [oceanbase]> SELECT * FROM oceanbase.GV$OB_MERGE_INFO WHERE TENANT_ID=1002 AND TABLET_ID=101106 ORDER BY START_TIME DESC LIMIT 10;The query result is as follows:
+----------------+----------+-----------+-------+-----------+--------------+---------------------+----------------------------+----------------------------+-------------------+-----------+-----------------+ | SVR_IP | SVR_PORT | TENANT_ID | LS_ID | TABLET_ID | ACTION | COMPACTION_SCN | START_TIME | END_TIME | MACRO_BLOCK_COUNT | REUSE_PCT | PARALLEL_DEGREE | +----------------+----------+-----------+-------+-----------+--------------+---------------------+----------------------------+----------------------------+-------------------+-----------+-----------------+ | 172.xx.xxx.xxx | 2882 | 1002 | 1 | 101106 | MEDIUM_MERGE | 1773044346622805000 | 2026-03-09 16:21:06.800772 | 2026-03-09 16:21:06.815196 | 1 | 0.00 | 1 | | 172.xx.xxx.xxx | 2882 | 1002 | 1 | 101106 | MINI_MERGE | 1773044230029441000 | 2026-03-09 16:19:46.413401 | 2026-03-09 16:19:46.420119 | 1 | 0.00 | 1 | | 172.xx.xxx.xxx | 2882 | 1002 | 1 | 101106 | MINI_MERGE | 1773044111197275001 | 2026-03-09 16:15:11.393854 | 2026-03-09 16:15:11.399243 | 1 | 0.00 | 1 | | 172.xx.xxx.xxx | 2882 | 1002 | 1 | 101106 | MAJOR_MERGE | 1772992801519693000 | 2026-03-09 02:05:24.242726 | 2026-03-09 02:05:24.258979 | 1 | 0.00 | 1 | | 172.xx.xxx.xxx | 2882 | 1002 | 1 | 101106 | MINI_MERGE | 1772992930030529000 | 2026-03-09 02:03:27.452490 | 2026-03-09 02:03:27.457785 | 1 | 0.00 | 1 | | 172.xx.xxx.xxx | 2882 | 1002 | 1 | 101106 | MINI_MERGE | 1772992801522849001 | 2026-03-09 02:00:02.426948 | 2026-03-09 02:00:02.433967 | 1 | 0.00 | 1 | | 172.xx.xxx.xxx | 2882 | 1002 | 1 | 101106 | MAJOR_MERGE | 1772906404772256000 | 2026-03-08 02:04:55.411995 | 2026-03-08 02:04:55.428263 | 1 | 0.00 | 1 | | 172.xx.xxx.xxx | 2882 | 1002 | 1 | 101106 | MINI_MERGE | 1772906530028843000 | 2026-03-08 02:03:00.677384 | 2026-03-08 02:03:00.684448 | 1 | 0.00 | 1 | | 172.xx.xxx.xxx | 2882 | 1002 | 1 | 101106 | MINI_MERGE | 1772906404777532001 | 2026-03-08 02:00:05.661945 | 2026-03-08 02:00:05.669834 | 1 | 0.00 | 1 | | 172.xx.xxx.xxx | 2882 | 1002 | 1 | 101106 | MAJOR_MERGE | 1772820003066690000 | 2026-03-07 02:02:21.913053 | 2026-03-07 02:02:21.926392 | 1 | 0.00 | 1 | +----------------+----------+-----------+-------+-----------+--------------+---------------------+----------------------------+----------------------------+-------------------+-----------+-----------------+ 10 rows in setThe following table describes the values in the
ACTIONcolumn.MDS_TABLE_MERGE: The system metadata is persisted to the disk in the SSTable format.MAJOR_MERGE: The major compaction of a tenant.MEDIUM_MERGE: The major compaction of a partition.MINI_MERGE: Mini Compaction. The MemTable is converted to a Mini SSTable.MINOR_MERGE: Minor Compaction. Multiple Mini SSTables are merged into one Mini SSTable, or multiple Mini SSTables and one Minor SSTable are merged into one Minor SSTable.META_MAJOR_MERGE: A special type of compaction. The data before a specified time point is merged into a Meta Major SSTable. The data format of the Meta Major SSTable is the same as that of the Major SSTable. The Meta Major SSTable does not contain multi-version data or uncommitted transaction data.
For more information about the other fields in the
GV$OB_MERGE_INFOview, see GV$OB_MERGE_INFO.The
GV$OB_TABLET_COMPACTION_HISTORYview displays the detailed history of the major compactions of partitions.obclient [oceanbase]> SELECT * FROM oceanbase.GV$OB_TABLET_COMPACTION_HISTORY WHERE TENANT_ID=1002 AND TABLET_ID=101106 ORDER BY START_TIME DESC LIMIT 2\GThe query result is as follows:
*************************** 1. row *************************** SVR_IP: 172.xx.xxx.xxx SVR_PORT: 2882 TENANT_ID: 1002 LS_ID: 1 TABLET_ID: 101106 TYPE: MEDIUM_MERGE COMPACTION_SCN: 1773044346622805000 START_TIME: 2026-03-09 16:21:06.800772 FINISH_TIME: 2026-03-09 16:21:06.815196 TASK_ID: YB42AC1E87E2-00064B8EBD3C7919-0-0 OCCUPY_SIZE: 23337 MACRO_BLOCK_COUNT: 1 MULTIPLEXED_MACRO_BLOCK_COUNT: 0 NEW_MICRO_COUNT_IN_NEW_MACRO: 3 MULTIPLEXED_MICRO_COUNT_IN_NEW_MACRO: 2 TOTAL_ROW_COUNT: 1786 INCREMENTAL_ROW_COUNT: 79 COMPRESSION_RATIO: 0.14 NEW_FLUSH_DATA_RATE: 2905 PROGRESSIVE_COMPACTION_ROUND: 1 PROGRESSIVE_COMPACTION_NUM: 0 PARALLEL_DEGREE: 1 PARALLEL_INFO: - PARTICIPANT_TABLE: table_cnt=4,[MAJOR]snapshot_version=1772992801519693000;[MINI]start_scn=1772992801522849001,end_scn=1773044230029441000; MACRO_ID_LIST: 15945 COMMENTS: cost_mb=2;win="{score:78, base_inc_row_cnt:78, dynamic_info:{query_cnt:0, read_amp:1.00, info:32768, ver:0}}"; START_CG_ID: 0 END_CG_ID: 0 KEPT_SNAPSHOT: {type:"LS_RESERVED", snapshot:1773042651332941000} MERGE_LEVEL: MICRO_BLOCK_LEVEL EXEC_MODE: EXEC_MODE_LOCAL IS_FULL_MERGE: FALSE IO_COST_TIME_PERCENTAGE: 0 MERGE_REASON: WINDOW_COMPACTION BASE_MAJOR_STATUS: CO_MERGE_TYPE: MDS_FILTER_INFO: EXECUTE_TIME: 6265 FILTER_ROW_COUNT: 0 *************************** 2. row *************************** SVR_IP: 172.xx.xxx.xxx SVR_PORT: 2882 TENANT_ID: 1002 LS_ID: 1 TABLET_ID: 101106 TYPE: MINI_MERGE COMPACTION_SCN: 1773044230029441000 START_TIME: 2026-03-09 16:19:46.413401 FINISH_TIME: 2026-03-09 16:19:46.420119 TASK_ID: YB42AC1E87E2-00064B8EBD3C7912-0-0 OCCUPY_SIZE: 393 MACRO_BLOCK_COUNT: 1 MULTIPLEXED_MACRO_BLOCK_COUNT: 0 NEW_MICRO_COUNT_IN_NEW_MACRO: 1 MULTIPLEXED_MICRO_COUNT_IN_NEW_MACRO: 0 TOTAL_ROW_COUNT: 1 INCREMENTAL_ROW_COUNT: 1 COMPRESSION_RATIO: 1 NEW_FLUSH_DATA_RATE: 59 PROGRESSIVE_COMPACTION_ROUND: 0 PROGRESSIVE_COMPACTION_NUM: 0 PARALLEL_DEGREE: 1 PARALLEL_INFO: - PARTICIPANT_TABLE: table_cnt=1,start_scn=1773044111197275001,end_scn=1773044230029441000; MACRO_ID_LIST: 15945 COMMENTS: cost_mb=2; START_CG_ID: 0 END_CG_ID: 0 KEPT_SNAPSHOT: {type:"LS_RESERVED", snapshot:1773042571305127000} MERGE_LEVEL: MACRO_BLOCK_LEVEL EXEC_MODE: EXEC_MODE_LOCAL IS_FULL_MERGE: FALSE IO_COST_TIME_PERCENTAGE: 0 MERGE_REASON: BASE_MAJOR_STATUS: CO_MERGE_TYPE: MDS_FILTER_INFO: EXECUTE_TIME: 1070 FILTER_ROW_COUNT: 0 2 rows in setThe following table describes the values in the
TYPEcolumn.MDS_TABLE_MERGE: The system metadata is persisted to the disk in the SSTable format.MAJOR_MERGE: The major compaction of a tenant.MEDIUM_MERGE: The major compaction of a partition.MINI_MERGE: Mini Compaction. The MemTable is converted to a Mini SSTable.MINOR_MERGE: Minor Compaction. Multiple Mini SSTables are merged into one Mini SSTable, or multiple Mini SSTables and one Minor SSTable are merged into one Minor SSTable.META_MAJOR_MERGE: A special type of compaction. The data before a specified time point is merged into a Meta Major SSTable. The data format of the Meta Major SSTable is the same as that of the Major SSTable. The Meta Major SSTable does not contain multi-version data or uncommitted transaction data.
For more information about the other fields in the
GV$OB_TABLET_COMPACTION_HISTORYview, see GV$OB_TABLET_COMPACTION_HISTORY.
View the compaction information of the current user tenant
A user tenant can view the compaction information of the current user tenant by using a view.
Log in to the database as the tenant administrator of the user tenant.
Execute the following statement to view the compaction information.
MySQL modeOracle modeQuery the
DBA_OB_ZONE_MAJOR_COMPACTIONorDBA_OB_MAJOR_COMPACTIONview to view the tenant-level compaction information of the current user tenant.The
DBA_OB_ZONE_MAJOR_COMPACTIONview displays the compaction information of each zone in the current user tenant.obclient [oceanbase]> SELECT * FROM oceanbase.DBA_OB_ZONE_MAJOR_COMPACTION;The query result is as follows:
+-------+---------------------+---------------------+----------------------------+----------------------------+--------+ | ZONE | BROADCAST_SCN | LAST_SCN | LAST_FINISH_TIME | START_TIME | STATUS | +-------+---------------------+---------------------+----------------------------+----------------------------+--------+ | zone1 | 1748455202538454000 | 1748455202538454000 | 2025-05-29 02:04:34.174642 | 2025-05-29 02:00:02.679713 | IDLE | +-------+---------------------+---------------------+----------------------------+----------------------------+--------+ 1 row in setObserve the
statuscolumn in the execution result. The following table describes some parameters.Field Description ZONE The name of the zone. BROADCAST_SCN The version number of the broadcast compaction. LAST_SCN The version number of the last compaction. LAST_FINISH_TIME The end time of the last compaction. START_TIME The start time of the compaction. STATUS The status of the compaction. Valid values: IDLE: No compaction is in progress.COMPACTING: A compaction is in progress.VERIFYING: The checksum is being verified.
The
DBA_OB_MAJOR_COMPACTIONview displays the global compaction information of the current user tenant.obclient [oceanbase]> SELECT * FROM oceanbase.DBA_OB_MAJOR_COMPACTION;The query result is as follows:
+---------------------+----------------------------+----------------------+---------------------+----------------------------+----------------------------+------------+----------+--------------+------+--------+ | FROZEN_SCN | FROZEN_TIME | GLOBAL_BROADCAST_SCN | LAST_SCN | LAST_FINISH_TIME | START_TIME | STATUS | IS_ERROR | IS_SUSPENDED | INFO | MODE | +---------------------+----------------------------+----------------------+---------------------+----------------------------+----------------------------+------------+----------+--------------+------+--------+ | 1772992801519693000 | 2026-03-09 02:00:01.519693 | 1772992801519693000 | 1772992801519693000 | 2026-03-09 02:05:42.538179 | 2026-03-09 16:15:11.214954 | COMPACTING | NO | NO | | WINDOW | +---------------------+----------------------------+----------------------+---------------------+----------------------------+----------------------------+------------+----------+--------------+------+--------+ 1 row in setObserve the
statuscolumn in the execution result. The following table describes some parameters.Field Description FROZEN_SCN The version number of the last compaction. FROZEN_TIME The readable time type of FROZEN_SCN.GLOBAL_BROADCAST_SCN The global broadcast compaction version. LAST_SCN The version of the last completed compaction. LAST_FINISH_TIME The end time of the last compaction. START_TIME The start time of the compaction. STATUS The status of the compaction. Valid values: IDLE: No compaction is in progress.COMPACTING: A compaction is in progress.VERIFYING: The checksum is being verified.
IS_ERROR YES: An error occurred during the compaction.NO: No error occurred during the compaction.
IS_SUSPENDED YES: The compaction is suspended.NO: The compaction is not suspended.
INFO The compaction information. Mode The type of daily compaction. Valid values: TENANT: tenant-level compaction.WINDOW: window compaction.
Query the
GV$OB_TABLET_COMPACTION_HISTORYview to view the partition-level compaction information of the current user tenant.The
GV$OB_TABLET_COMPACTION_HISTORYview displays the detailed history of tablet-level compactions.obclient [oceanbase]> SELECT * FROM oceanbase.GV$OB_TABLET_COMPACTION_HISTORY WHERE TABLET_ID=101106 ORDER BY START_TIME DESC LIMIT 2\GThe query result is as follows:
*************************** 1. row *************************** SVR_IP: 172.xx.xxx.xxx SVR_PORT: 2882 TENANT_ID: 1002 LS_ID: 1 TABLET_ID: 101106 TYPE: MEDIUM_MERGE COMPACTION_SCN: 1773044346622805000 START_TIME: 2026-03-09 16:21:06.800772 FINISH_TIME: 2026-03-09 16:21:06.815196 TASK_ID: YB42AC1E87E2-00064B8EBD3C7919-0-0 OCCUPY_SIZE: 23337 MACRO_BLOCK_COUNT: 1 MULTIPLEXED_MACRO_BLOCK_COUNT: 0 NEW_MICRO_COUNT_IN_NEW_MACRO: 3 MULTIPLEXED_MICRO_COUNT_IN_NEW_MACRO: 2 TOTAL_ROW_COUNT: 1786 INCREMENTAL_ROW_COUNT: 79 COMPRESSION_RATIO: 0.14 NEW_FLUSH_DATA_RATE: 2905 PROGRESSIVE_COMPACTION_ROUND: 1 PROGRESSIVE_COMPACTION_NUM: 0 PARALLEL_DEGREE: 1 PARALLEL_INFO: - PARTICIPANT_TABLE: table_cnt=4,[MAJOR]snapshot_version=1772992801519693000;[MINI]start_scn=1772992801522849001,end_scn=1773044230029441000; MACRO_ID_LIST: 15945 COMMENTS: cost_mb=2;win="{score:78, base_inc_row_cnt:78, dynamic_info:{query_cnt:0, read_amp:1.00, info:32768, ver:0}}"; START_CG_ID: 0 END_CG_ID: 0 KEPT_SNAPSHOT: {type:"LS_RESERVED", snapshot:1773042651332941000} MERGE_LEVEL: MICRO_BLOCK_LEVEL EXEC_MODE: EXEC_MODE_LOCAL IS_FULL_MERGE: FALSE IO_COST_TIME_PERCENTAGE: 0 MERGE_REASON: WINDOW_COMPACTION BASE_MAJOR_STATUS: CO_MERGE_TYPE: MDS_FILTER_INFO: EXECUTE_TIME: 6265 FILTER_ROW_COUNT: 0 *************************** 2. row *************************** SVR_IP: 172.xx.xxx.xxx SVR_PORT: 2882 TENANT_ID: 1002 LS_ID: 1 TABLET_ID: 101106 TYPE: MINI_MERGE COMPACTION_SCN: 1773044230029441000 START_TIME: 2026-03-09 16:19:46.413401 FINISH_TIME: 2026-03-09 16:19:46.420119 TASK_ID: YB42AC1E87E2-00064B8EBD3C7912-0-0 OCCUPY_SIZE: 393 MACRO_BLOCK_COUNT: 1 MULTIPLEXED_MACRO_BLOCK_COUNT: 0 NEW_MICRO_COUNT_IN_NEW_MACRO: 1 MULTIPLEXED_MICRO_COUNT_IN_NEW_MACRO: 0 TOTAL_ROW_COUNT: 1 INCREMENTAL_ROW_COUNT: 1 COMPRESSION_RATIO: 1 NEW_FLUSH_DATA_RATE: 59 PROGRESSIVE_COMPACTION_ROUND: 0 PROGRESSIVE_COMPACTION_NUM: 0 PARALLEL_DEGREE: 1 PARALLEL_INFO: - PARTICIPANT_TABLE: table_cnt=1,start_scn=1773044111197275001,end_scn=1773044230029441000; MACRO_ID_LIST: 15945 COMMENTS: cost_mb=2; START_CG_ID: 0 END_CG_ID: 0 KEPT_SNAPSHOT: {type:"LS_RESERVED", snapshot:1773042571305127000} MERGE_LEVEL: MACRO_BLOCK_LEVEL EXEC_MODE: EXEC_MODE_LOCAL IS_FULL_MERGE: FALSE IO_COST_TIME_PERCENTAGE: 0 MERGE_REASON: BASE_MAJOR_STATUS: CO_MERGE_TYPE: MDS_FILTER_INFO: EXECUTE_TIME: 1070 FILTER_ROW_COUNT: 0 2 rows in setThe following table describes the values in the
TYPEcolumn.MDS_TABLE_MERGE: The system metadata is persisted to the disk in the SSTable format.MAJOR_MERGE: tenant-level compactionMEDIUM_MERGE: partition-level compactionMINI_MERGE: Mini Compaction. The MemTable is converted into a Mini SSTable.MINOR_MERGE: Minor Compaction. Multiple Mini SSTables are merged into a new Mini SSTable, or multiple Mini SSTables and one Minor SSTable are merged into a new Minor SSTable.META_MAJOR_MERGE: A special type of compaction. The data before a specified time point is merged into a Meta Major SSTable. The data format of the Meta Major SSTable is the same as that of a Major SSTable. The Meta Major SSTable does not contain multi-version data or uncommitted transaction data.
For more information about the other fields in the
GV$OB_TABLET_COMPACTION_HISTORYview, see GV$OB_TABLET_COMPACTION_HISTORY.
Query the
DBA_OB_ZONE_MAJOR_COMPACTIONorDBA_OB_MAJOR_COMPACTIONview to view the tenant-level compaction information of the current user tenant.The
DBA_OB_ZONE_MAJOR_COMPACTIONview displays the compaction information of each zone in the current user tenant.obclient [TEST]> SELECT * FROM SYS.DBA_OB_ZONE_MAJOR_COMPACTION;The query result is as follows:
+-------+---------------------+----------+------------------+------------------+------------+ | ZONE | BROADCAST_SCN | LAST_SCN | LAST_FINISH_TIME | START_TIME | STATUS | +-------+---------------------+----------+------------------+------------------+------------+ | zone1 | 1748487596765126000 | 1 | 0 | 1748487596921347 | COMPACTING | +-------+---------------------+----------+------------------+------------------+------------+ 1 row in setObserve the
statuscolumn in the execution result. The following table describes some parameters.Field Description ZONE The name of the zone. BROADCAST_SCN The version number of the broadcast compaction. LAST_SCN The version number of the last compaction. LAST_FINISH_TIME The end time of the last compaction. START_TIME The start time of the compaction. STATUS The status of the compaction. Valid values: IDLE: No compaction is in progress.COMPACTING: A compaction is in progress.VERIFYING: The checksum is being verified.
The
DBA_OB_MAJOR_COMPACTIONview displays the global compaction information of the current user tenant.obclient [TEST]> SELECT * FROM SYS.DBA_OB_MAJOR_COMPACTION;The query result is as follows:
+---------------------+----------------------+---------------------+------------------+------------------+------------+----------+--------------+------+--------+ | FROZEN_SCN | GLOBAL_BROADCAST_SCN | LAST_SCN | LAST_FINISH_TIME | START_TIME | STATUS | IS_ERROR | IS_SUSPENDED | INFO | MODE | +---------------------+----------------------+---------------------+------------------+------------------+------------+----------+--------------+------+--------+ | 1772647200462679000 | 1772647200462679000 | 1772647200462679000 | 1772647531394359 | 1773049642612055 | COMPACTING | NO | NO | NULL | WINDOW | +---------------------+----------------------+---------------------+------------------+------------------+------------+----------+--------------+------+--------+ 1 row in setObserve the
statuscolumn in the execution result. The following table describes some parameters.Field Description FROZEN_SCN The latest major compaction snapshot. GLOBAL_BROADCAST_SCN The global broadcast major compaction version. LAST_SCN The previous major compaction version. LAST_FINISH_TIME The end time of the last major compaction. START_TIME The start time of the major compaction. STATUS The status of the major compaction. Valid values: IDLECOMPACTINGVERIFYING
IS_ERROR YESNO
IS_SUSPENDED YESNO
INFO The information about the major compaction. Mode The type of the major compaction. Valid values: TENANTWINDOW
Query the
GV$OB_TABLET_COMPACTION_HISTORYview to obtain the partition-level major compaction information of the current tenant.The
GV$OB_TABLET_COMPACTION_HISTORYview displays the detailed history of tablet-level major compactions.obclient [TEST]> SELECT * FROM SYS.GV$OB_TABLET_COMPACTION_HISTORY WHERE TABLET_ID=200001 AND ROWNUM<=1 ORDER BY START_TIME\GThe query result is as follows:
*************************** 1. row *************************** SVR_IP: 172.xx.xxx.xxx SVR_PORT: 2882 TENANT_ID: 1004 LS_ID: 1001 TABLET_ID: 200001 TYPE: MAJOR_MERGE COMPACTION_SCN: 1772128801860733000 START_TIME: 27-FEB-26 02.02.20.282248 AM FINISH_TIME: 27-FEB-26 02.02.20.289095 AM TASK_ID: YB42AC1E87E2-00064B8EC49BF3A8-0-0 OCCUPY_SIZE: 0 MACRO_BLOCK_COUNT: 0 MULTIPLEXED_MACRO_BLOCK_COUNT: 0 NEW_MICRO_COUNT_IN_NEW_MACRO: 0 MULTIPLEXED_MICRO_COUNT_IN_NEW_MACRO: 0 TOTAL_ROW_COUNT: 0 INCREMENTAL_ROW_COUNT: 0 COMPRESSION_RATIO: 1 NEW_FLUSH_DATA_RATE: 0 PROGRESSIVE_COMPACTION_ROUND: 1 PROGRESSIVE_COMPACTION_NUM: 0 PARALLEL_DEGREE: 1 PARALLEL_INFO: - PARTICIPANT_TABLE: table_cnt=1,[MAJOR]snapshot_version=1772042400527019001; MACRO_ID_LIST: NULL COMMENTS: NULL START_CG_ID: 0 END_CG_ID: 0 KEPT_SNAPSHOT: {type:"UNDO_RETENTION", snapshot:1772127131974068000} MERGE_LEVEL: MICRO_BLOCK_LEVEL EXEC_MODE: EXEC_MODE_LOCAL IS_FULL_MERGE: FALSE IO_COST_TIME_PERCENTAGE: 0 MERGE_REASON: TENANT_MAJOR BASE_MAJOR_STATUS: NULL CO_MERGE_TYPE: NULL MDS_FILTER_INFO: NULL EXECUTE_TIME: 653 FILTER_ROW_COUNT: 0 1 row in setThe following table describes the values in the
TYPEcolumn.MDS_TABLE_MERGE: persist the system metadata in the SSTable format to the disk.MAJOR_MERGE: major compaction at the tenant level.MEDIUM_MERGE: major compaction at the partition level.MINI_MERGE: minor compaction, which converts the MemTable to a Mini SSTable.MINOR_MERGE: minor compaction, which combines multiple Mini SSTables into a new Mini SSTable or combines multiple Mini SSTables with one Minor SSTable into a new Minor SSTable.META_MAJOR_MERGE: a special type of compaction. It combines the data before a specified time point into a Meta Major SSTable. The data format of the Meta Major SSTable is the same as that of the Major SSTable. It does not contain multi-version data or uncommitted transaction data.
For more information about the other fields in the
GV$OB_TABLET_COMPACTION_HISTORYview, see GV$OB_TABLET_COMPACTION_HISTORY.
