Note
This view is available starting with V4.6.2.1.
Overview
Displays the historical information of all terminated AI batch tasks in the cluster. It is commonly used under the sys tenant to track the results, token consumption, and task duration of index-building tasks in batch file mode for each tenant.
About 10 minutes after a task completes or fails, it is archived from this view to the history view. The internal numerical status in the view is converted into a string, and the progress percentage is calculated based on the number of processed requests compared to the total number of requests.
Compared with the task view, this view additionally provides statistics on token usage (TOKEN_USAGE) and batch task duration information (PROVIDER_TIMELINE).
Columns
Column |
Type |
Is NULL |
Description |
|---|---|---|---|
| TENANT_ID | bigint(20) | NO | Tenant ID. |
| TASK_ID | varchar(256) | NO | Unique identifier of the AI batch task. |
| DDL_TASK_ID | bigint(20) | YES | Associated DDL task ID. When creating an index in a batch file, this corresponds to the CREATE VECTOR INDEX The triggered DDL task. |
| MODEL_NAME | varchar(256) | NO | The name of the AI model used. Corresponding to DBMS_AI_SERVICE The name of the model registered in the model registry. |
| COMMAND_TYPE | varchar(256) | NO | AI call type, for example, EMBED. |
| STATUS | varchar(256) | NO | Final task status. Valid values: INVALID, PENDING, RUNNING, FINISHED, FAILED, CANCELLED, UNKNOWN. |
| REQUESTS_HANDLED | bigint(20) | NO | Number of requests processed. |
| TOTAL_REQUESTS | bigint(20) | NO | Total Requests. |
| PROGRESS_PERCENT | decimal | YES | Task progress percentage, calculated by REQUESTS_HANDLED / TOTAL_REQUESTS Calculate. |
| TASK_CREATE_TIME | timestamp | NO | Task creation time. |
| TASK_UPDATE_TIME | timestamp | NO | The last time the task status was updated. |
| BATCH_ID | varchar(256) | YES | The batch task ID on the AI service provider side. |
| REMOTE_FILE_IDS | varchar(2048) | YES | File ID on the AI service provider side, in JSON format. Example in OpenAI style: {"input_file_id":"file-in-xxx","output_file_id":"file-out-xxx","error_file_id":"file-err-xxx"}; Anthropic style example: {"output_file_id":"msgbatch_yyy_result"}. |
| ERROR_DETAIL | varchar(4096) | YES | Error messages of OceanBase AI Database and the model, in JSON format. Example: {"ob_error_code":0,"model_http_code":429,"message":"Rate limit exceeded for requests"}. |
| TOKEN_USAGE | varchar(1024) | YES | The number of tokens actually consumed by the batch task on the AI service provider's side is returned as a JSON string. Example: {"completion_tokens":1,"prompt_tokens":1,"total_tokens":2}. |
| PROVIDER_TIMELINE | varchar(1024) | YES | Timestamps of each stage in the batch job on the AI service provider side, represented as a JSON string in Unix seconds. The fields include: created_at, in_progress_at, finalizing_at, completed_at, failed_at, expired_at, expires_at, cancelling_at, cancelled_at, all of which can be empty. Example: {"created_at":1746000000,"in_progress_at":1746000060,"completed_at":1746003700}. |
Sample query
Query the system tenant for the history of completed tasks across all tenants in the cluster:
obclient [oceanbase]> SELECT * FROM oceanbase.CDB_OB_AI_BATCH_TASK_HISTORY;
Return example:
+-----------+-------------------------------------+-------------+-------------------+--------------+----------+------------------+----------------+------------------+----------------------------+----------------------------+------------------------+----------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------+------------------------------------------------------------+---------------------------------+
| TENANT_ID | TASK_ID | DDL_TASK_ID | MODEL_NAME | COMMAND_TYPE | STATUS | REQUESTS_HANDLED | TOTAL_REQUESTS | PROGRESS_PERCENT | TASK_CREATE_TIME | TASK_UPDATE_TIME | BATCH_ID | REMOTE_FILE_IDS | ERROR_DETAIL | TOKEN_USAGE | PROVIDER_TIMELINE |
+-----------+-------------------------------------+-------------+-------------------+--------------+----------+------------------+----------------+------------------+----------------------------+----------------------------+------------------------+----------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------+------------------------------------------------------------+---------------------------------+
| 1004 | ai_1002_1780641797310516_1543562579 | 106 | ob_embed_endpoint | EMBED | FINISHED | 1 | 1 | 100.00 | 2026-06-05 14:43:17.310525 | 2026-06-05 14:44:20.458616 | batch_38268a491ed64a90 | {"input_file_id": "file-batch-292094790baf42d8", "output_file_id": "file-batch_output-5488cbb816f347e6"} | {"message": "", "ob_error_code": 0, "model_http_code": 0} | {"completion_tokens":0,"prompt_tokens":6,"total_tokens":6} | {"model_wait_time_us":61193090} |
+-----------+-------------------------------------+-------------+-------------------+--------------+----------+------------------+----------------+------------------+----------------------------+----------------------------+------------------------+----------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------+------------------------------------------------------------+---------------------------------+
1 row in set