Note
This view is available starting with V4.6.2.1.
Overview
Displays the historical information of completed AI batch tasks for the current tenant. It is commonly used to trace the results of index creation tasks in batch file mode, token consumption, and the time spent at each stage on the service provider side.
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 and the total number of requests.
Compared with the task view, this view additionally provides statistics on token usage (TOKEN_USAGE) and timestamps for each phase of the batch job on the AI service provider side (PROVIDER_TIMELINE).
Columns
Column |
Type |
Is NULL |
Description |
|---|---|---|---|
| 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 DDL task that was triggered. |
| 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 based on the number of rows processed 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. The value is a JSON string. Example: {"message": "", "ob_error_code": 0, "model_http_code": 0}. |
| TOKEN_USAGE | varchar(1024) | YES | The actual number of tokens 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 for each stage of the batch job on the AI service provider side, in JSON format and 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 history of terminated tasks within the current tenant:
obclient [oceanbase]> SELECT * FROM oceanbase.DBA_OB_AI_BATCH_TASK_HISTORY;
Response example:
obclient [oceanbase]> SELECT * FROM oceanbase.DBA_OB_AI_BATCH_TASK_HISTORY;
+----------------------------------------------+-------------+-------------------+--------------+-----------+------------------+----------------+------------------+----------------------------+----------------------------+------------------------+----------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------+------------------------------------------------------------+---------------------------------+
| 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 |
+----------------------------------------------+-------------+-------------------+--------------+-----------+------------------+----------------+------------------+----------------------------+----------------------------+------------------------+----------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------+------------------------------------------------------------+---------------------------------+
| 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