CANCEL JOB

On this page Carat arrow pointing down
Warning:
CockroachDB v2.1 is no longer supported as of April 30, 2020. For more details, refer to the Release Support Policy.

The CANCEL JOB statement lets you stop long-running jobs, which include IMPORT jobs, enterprise BACKUP and RESTORE jobs, and as of v2.1, schema changes and changefeeds.

Limitations

When an enterprise RESTORE is canceled, partially restored data is properly cleaned up. This can have a minor, temporary impact on cluster performance.

Required privileges

Only members of the admin role can cancel a job. By default, the root user belongs to the admin role.

Synopsis

CANCEL JOB job_id JOBS select_stmt

Parameters

Parameter Description
job_id The ID of the job you want to cancel, which can be found with SHOW JOBS.
select_stmt A selection query that returns job_id(s) to cancel.

Examples

Cancel a single job

> SHOW JOBS;
+----------------+---------+-------------------------------------------+...
|       id       |  type   |               description                 |...
+----------------+---------+-------------------------------------------+...
| 27536791415282 | RESTORE | RESTORE db.* FROM 'azure://backup/db/tbl' |...
+----------------+---------+-------------------------------------------+...
> CANCEL JOB 27536791415282;

Cancel multiple jobs

New in v2.1: To cancel multiple jobs, nest a SELECT clause that retrieves job_id(s) inside the CANCEL JOBS statement:

icon/buttons/copy
> CANCEL JOBS (SELECT job_id FROM [SHOW JOBS]
      WHERE user_name = 'maxroach');

All jobs created by maxroach will be cancelled.

See also


Yes No
On this page

Yes No