Note
This view is available starting with V4.6.0.
Purpose
The oceanbase.DBA_OB_TTL_TASK_HISTORY view displays the execution history of TTL tasks in the current user tenant in SQL mode.
Columns
| Column | Type | Nullable | Description |
|---|---|---|---|
| TABLE_NAME | varchar(256) | NO | The name of the table. |
| TABLE_ID | bigint(20) | NO | The ID of the table. |
| TASK_ID | bigint(20) | NO | The ID of the current batch task. |
| START_TIME | timestamp(6) | NO | The start time of the task. |
| MODIFIED_TIME | timestamp(6) | NO | The update time of the row. |
| TRIGGER_TYPE | varchar(8) | NO | The type of the task trigger. Valid values:
|
| STATUS | varchar(10) | NO | The status of the task. Valid values:
|
| RET_CODE | varchar(512) | NO | The error code returned when the task is completed. |
| TASK_TYPE | varchar(10) | NO | The type of the TTL task. Valid values:
|
Sample query
Query the execution history of TTL tasks in the current user tenant.
obclient(root@mysql001)[oceanbase]> SELECT * FROM oceanbase.DBA_OB_TTL_TASK_HISTORY;
The query result is as follows:
+------------+----------+---------+----------------------------+----------------------------+--------------+----------+------------+------------+
| TABLE_NAME | TABLE_ID | TASK_ID | START_TIME | MODIFIED_TIME | TRIGGER_TYPE | STATUS | RET_CODE | TASK_TYPE |
+------------+----------+---------+----------------------------+----------------------------+--------------+----------+------------+------------+
| ttl_tbl1 | 500008 | 3 | 2026-03-11 11:05:08.212740 | 2026-03-11 11:05:08.221139 | USER | FINISHED | OB_SUCCESS | COMPACTION |
| ttl_tbl1 | 500008 | 2 | 2026-03-11 10:41:23.018283 | 2026-03-11 10:41:23.025330 | USER | FINISHED | OB_SUCCESS | COMPACTION |
| ttl_tbl1 | 500008 | 1 | 2026-03-11 10:37:22.934703 | 2026-03-11 10:37:22.945876 | USER | FINISHED | OB_SUCCESS | COMPACTION |
| ttl_tbl2 | 500009 | 3 | 2026-03-11 11:05:08.224464 | 2026-03-11 11:05:08.229749 | USER | FINISHED | OB_SUCCESS | COMPACTION |
| ttl_tbl2 | 500009 | 2 | 2026-03-11 10:41:23.028355 | 2026-03-11 10:41:23.033363 | USER | FINISHED | OB_SUCCESS | COMPACTION |
| ttl_tbl2 | 500009 | 1 | 2026-03-11 10:37:22.952009 | 2026-03-11 10:37:22.958490 | USER | FINISHED | OB_SUCCESS | COMPACTION |
| NULL | -1 | 1 | 2026-03-11 10:37:18.061066 | 2026-03-11 10:37:22.970234 | USER | FINISHED | OB_SUCCESS | COMPACTION |
| NULL | -1 | 2 | 2026-03-11 10:41:13.700826 | 2026-03-11 10:41:23.045337 | USER | FINISHED | OB_SUCCESS | COMPACTION |
| NULL | -1 | 3 | 2026-03-11 11:05:05.235833 | 2026-03-11 11:05:08.242563 | USER | FINISHED | OB_SUCCESS | COMPACTION |
+------------+----------+---------+----------------------------+----------------------------+--------------+----------+------------+------------+
9 rows in set
References
Query the execution status of TTL tasks in the current user tenant: DBA_OB_TTL_TASKS
Query TTL tasks in all user tenants:
