Overview
The oceanbase.DBA_OB_TTL_TASK_HISTORY view displays the execution history of TTL tasks for the current tenant in SQL mode.
Columns
field |
Type |
Is NULL |
Description |
|---|---|---|---|
| TABLE_NAME | varchar(256) | NO | Table name |
| TABLE_ID | bigint(20) | NO | Table ID |
| TASK_ID | bigint(20) | NO | The ID of the current batch task. |
| START_TIME | timestamp(6) | NO | Task Start Time |
| MODIFIED_TIME | timestamp(6) | NO | Row Update Time |
| TRIGGER_TYPE | varchar(8) | NO | Task trigger type:
|
| STATUS | varchar(10) | NO | Task status:
|
| RET_CODE | varchar(512) | NO | Error code returned at the end of the task |
| TASK_TYPE | varchar(10) | NO | TTL Task Type:
|
Sample query
You can query the execution history of the TTL task for the current 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
View the execution status of TTL tasks for the current tenant: DBA_OB_TTL_TASKS
View the TTL tasks of all user tenants: