After you initiate a minor compaction, you can query the minor compaction progress and history from the relevant views.
View the minor compaction progress
Log in to the
systenant or a user tenant as the administrator.View the progress information such as the amount of data that has not been compacted and the estimated completion time.
The
GV$OB_TABLET_COMPACTION_PROGRESSview displays progress information of only ongoing tablet-level compaction tasks but not completed tasks. The query statements are as follows:View the minor compaction progress from the
systenantobclient> SELECT * FROM oceanbase.GV$OB_TABLET_COMPACTION_PROGRESS WHERE TYPE='MINI_MERGE'\GView the minor compaction progress from a user tenant
MySQL-compatible mode
obclient> SELECT * FROM oceanbase.GV$OB_TABLET_COMPACTION_PROGRESS WHERE TYPE='MINI_MERGE'\GOracle-compatible mode
obclient> SELECT * FROM SYS.GV$OB_TABLET_COMPACTION_PROGRESS WHERE TYPE='MINI_MERGE'\G
A sample query result is as follows:
*************************** 1. row *************************** SVR_IP: xx.xx.xx.xx SVR_PORT: 2401 TENANT_ID: 1002 TYPE: MINI_MERGE LS_ID: 1001 TABLET_ID: 1152921504606847235 COMPACTION_SCN: 1680514780195130031 TASK_ID: Y9610BA2DA3E-0005F7FD6E1FE0FF-0-0 STATUS: NODE_RUNNING DATA_SIZE: 31890729 UNFINISHED_DATA_SIZE: 3351030 PROGRESSIVE_COMPACTION_ROUND: 1 CREATE_TIME: 2023-04-03 17:49:17.278506 START_TIME: 2023-04-03 17:51:57.953999 ESTIMATED_FINISH_TIME: 2023-04-03 23:32:25.969930 START_CG_ID: 0 END_CG_ID: 0 1 row in setFields in the query result are described as follows:
TYPE: the type of the compaction task. Valid values include the following ones:MDS_TABLE_MERGE: indicates to persist system metadata to the disk in the SSTable format.MAJOR_MERGE: indicates a tenant-level major compaction.MEDIUM_MERGE: indicates a partition-level major compaction.MINI_MERGE: indicates a mini compaction task that converts a MemTable to a mini SSTable.MINOR_MERGE: indicates a minor compaction task that compacts multiple mini SSTables or multple mini SSTables and minor SSTables into one minor SSTable.META_MAJOR_MERGE: indicates a special compaction task that compacts the data generated before a specified point in time into a meta major SSTable, which has the same data format as a major SSTable but does not contain multi-version data or data of uncommitted transactions.
STATUS: the status of the compaction task. The valueNODE_RUNNINGindicates that the compaction task is running.DATA_SIZE: the total amount of data to be compacted.UNFINISHED_DATA_SIZE: the amount of data that has not been compacted.ESTIMATED_FINISH_TIME: the estimated time when the compaction task is completed.
For more information about the columns in the
GV$OB_TABLET_COMPACTION_PROGRESSview, see GV$OB_TABLET_COMPACTION_PROGRESS.If a tablet does not appear in this view or the minor compaction remains unfinished for a tablet after a long period of time, you can query the
GV$OB_COMPACTION_DIAGNOSE_INFOview to verify whether an exception occurs.For more information about the columns in the
GV$OB_COMPACTION_DIAGNOSE_INFOview, see GV$OB_COMPACTION_DIAGNOSE_INFO.
View the minor compaction history
Log in to the
systenant or a user tenant as the administrator.View the minor compaction history.
The
GV$OB_TABLET_COMPACTION_HISTORYview displays the tablet-level compaction history. The query statements are as follows:View the minor compaction history from the
systenantobclient> SELECT * FROM oceanbase.GV$OB_TABLET_COMPACTION_HISTORY WHERE TYPE='MINI_MERGE'\GView the minor compaction history from a user tenant
MySQL-compatible mode
obclient> SELECT * FROM oceanbase.GV$OB_TABLET_COMPACTION_HISTORY WHERE TYPE='MINI_MERGE'\GOracle-compatible mode
obclient> SELECT * FROM SYS.GV$OB_TABLET_COMPACTION_HISTORY WHERE TYPE='MINI_MERGE'\G
A sample query result is as follows:
*************************** 1. row *************************** SVR_IP: 172.xx.xxx.xxx SVR_PORT: 2882 TENANT_ID: 1002 LS_ID: 1 TABLET_ID: 49402 TYPE: MINI_MERGE COMPACTION_SCN: 1747418403693944001 START_TIME: 2025-05-17 02:00:03.718154 FINISH_TIME: 2025-05-17 02:00:03.755331 TASK_ID: YB42AC1E87E0-000635386FA2C34E-0-0 OCCUPY_SIZE: 2123360 MACRO_BLOCK_COUNT: 2 MULTIPLEXED_MACRO_BLOCK_COUNT: 0 NEW_MICRO_COUNT_IN_NEW_MACRO: 103 MULTIPLEXED_MICRO_COUNT_IN_NEW_MACRO: 0 TOTAL_ROW_COUNT: 17381 INCREMENTAL_ROW_COUNT: 17381 COMPRESSION_RATIO: 1 NEW_FLUSH_DATA_RATE: 62511 PROGRESSIVE_COMPACTION_ROUND: 0 PROGRESSIVE_COMPACTION_NUM: 0 PARALLEL_DEGREE: 1 PARALLEL_INFO: - PARTICIPANT_TABLE: table_cnt=1,start_scn=1,end_scn=1747418403693944001; MACRO_ID_LIST: 6280,6282 COMMENTS: comment="cost_mb=5;"; START_CG_ID: 0 END_CG_ID: 0 KEPT_SNAPSHOT: MERGE_LEVEL: MACRO_BLOCK_LEVEL EXEC_MODE: EXEC_MODE_LOCAL IS_FULL_MERGE: FALSE IO_COST_TIME_PERCENTAGE: 6 MERGE_REASON: BASE_MAJOR_STATUS: CO_MERGE_TYPE: MDS_FILTER_INFO: EXECUTE_TIME: 747 1 row in setFor more information about the columns in the
GV$OB_TABLET_COMPACTION_HISTORYview, see GV$OB_TABLET_COMPACTION_HISTORY.