Skip to main content

SHOW JOB STATUS

Description

Queries the status of an asynchronous task.

tip

The root user can view the status of all jobs, while a normal user can view only the status of their own jobs.

Syntax

SHOW JOB STATUS [WHERE job='job_id'];

Parameters

job_id: the unique ID of the asynchronous task. You can execute SHOW JOB STATUS to view the status of all tasks created by the current user, or use the where statement to specify job_id to view the status of a single task.

Examples

  • View the status of all tasks created by the current user.

    show job status;
    +------------------------+-------------+-----------+----------+----------------------------+----------------------------+------------------+
    | job_id | schema_name | status | fail_msg | create_time | update_time | definition |
    +------------------------+-------------+-----------+----------+----------------------------+----------------------------+------------------+
    | 2010011125899906847397 | oceanbase | FINISH | SUCCESS | 2024-08-02 17:56:19.441303 | 2024-08-02 17:56:30.529692 | select sleep(1); |
    | 2010011125899906847786 | oceanbase | SUBMITTED | NULL | 2024-08-02 17:58:11.814612 | 2024-08-02 17:58:11.815297 | select sleep(2); |
    | 2010011125899906847800 | oceanbase | SUBMITTED | NULL | 2024-08-02 17:58:14.885659 | 2024-08-02 17:58:14.886382 | select sleep(3); |
    +------------------------+-------------+-----------+----------+----------------------------+----------------------------+------------------+
    3 rows in set (0.012 sec)
  • You can also use the where clause to specify the job ID and view the status of a single task.

    show job status where job='2010011125899906847397';
    +------------------------+-------------+-----------+----------+----------------------------+----------------------------+------------------+
    | job_id | schema_name | status | fail_msg | create_time | update_time | definition |
    +------------------------+-------------+-----------+----------+----------------------------+----------------------------+------------------+
    | 2010011125899906847397 | oceanbase | FINISH | SUCCESS | 2024-08-02 17:56:19.441303 | 2024-08-02 17:56:30.529692 | select sleep(1); |
    +------------------------+-------------+-----------+----------+----------------------------+----------------------------+------------------+
    1 rows in set (0.006 sec)

Field Description

FieldDescription
job_idthe unique ID of the job.
schema_namethe name of the database.
statusthe running status of the job.
  • SUBMITTED: indicates that the task has been submitted.
  • RUNNING: indicates that the task is being scheduled (but may not have started execution yet).
  • FINISH: indicates that the task has been scheduled and executed successfully.
  • FAILED: indicates that the task has been scheduled but failed to execute.
  • CANCELLED: indicates that the task has been canceled.
fail_msgthe error message returned when the job runs.
create_timethe time when the job was created.
update_timethe time when the job status was last updated.
definitionthe SQL statement executed by the job.