Note
This view is available starting with V4.6.0.
Purpose
The oceanbase.CDB_OB_TTL_TASK_HISTORY view displays the execution history of TTL tasks for all user tenants in SQL mode.
Columns
| Column | Type | Nullable | Description |
|---|---|---|---|
| TENANT_ID | bigint(20) | NO | The tenant ID. |
| TABLE_NAME | varchar(256) | NO | The table name. |
| TABLE_ID | bigint(20) | NO | The table ID. |
| 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 trigger type of the task. 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 for all user tenants.
obclient(root@sys)[oceanbase]> SELECT * FROM oceanbase.CDB_OB_TTL_TASK_HISTORY;
The query result is as follows:
+-----------+------------+----------+---------+----------------------------+----------------------------+--------------+----------+------------+------------+
| TENANT_ID | TABLE_NAME | TABLE_ID | TASK_ID | START_TIME | MODIFIED_TIME | TRIGGER_TYPE | STATUS | RET_CODE | TASK_TYPE |
+-----------+------------+----------+---------+----------------------------+----------------------------+--------------+----------+------------+------------+
| 1002 | ttl_tbl1 | 500008 | 2 | 2026-03-11 10:41:23.018283 | 2026-03-11 10:41:23.025330 | USER | FINISHED | OB_SUCCESS | COMPACTION |
| 1002 | ttl_tbl1 | 500008 | 1 | 2026-03-11 10:37:22.934703 | 2026-03-11 10:37:22.945876 | USER | FINISHED | OB_SUCCESS | COMPACTION |
| 1002 | ttl_tbl2 | 500009 | 2 | 2026-03-11 10:41:23.028355 | 2026-03-11 10:41:23.033363 | USER | FINISHED | OB_SUCCESS | COMPACTION |
| 1002 | ttl_tbl2 | 500009 | 1 | 2026-03-11 10:37:22.952009 | 2026-03-11 10:37:22.958490 | USER | FINISHED | OB_SUCCESS | COMPACTION |
| 1002 | NULL | -1 | 1 | 2026-03-11 10:37:18.061066 | 2026-03-11 10:37:22.970234 | USER | FINISHED | OB_SUCCESS | COMPACTION |
| 1002 | NULL | -1 | 2 | 2026-03-11 10:41:13.700826 | 2026-03-11 10:41:23.045337 | USER | FINISHED | OB_SUCCESS | COMPACTION |
+-----------+------------+----------+---------+----------------------------+----------------------------+--------------+----------+------------+------------+
6 rows in set
References
View the execution history of TTL tasks for all user tenants: CDB_OB_TTL_TASKS
