CANCEL JOB lets you stop long-running jobs, which include:
- jobs
- and jobs
- jobs
- jobs
- jobs
- jobs (see Known limitations for exceptions)
Known limitations
-
To avoid transaction states that cannot properly , the following statements cannot be cancelled with :
DROPstatements (e.g., ).ALTER ... RENAMEstatements (e.g., ).- statements.
- statements, except for those that drop values.
- When an Enterprise is canceled, partially restored data is properly cleaned up. This can have a minor, temporary impact on cluster performance.
Required privileges
To cancel a job, the user must be a member of theadmin role or must have the set. Non-admin users cannot cancel admin users’ jobs.
For changefeeds, users with the privilege on a set of tables can cancel changefeed jobs running on those tables.
Synopsis
Cancel all jobs by type
Parameters
| Parameter | Description |
|---|---|
job_id | The ID of the job you want to cancel, which can be found with . |
select_stmt | A that returns job_id(s) to cancel. |
for_schedules_clause | The schedule you want to cancel jobs for. You can cancel jobs for a specific schedule (FOR SCHEDULE id) or cancel jobs for multiple schedules by nesting a in the statement (FOR SCHEDULES <select_clause>). See the examples below. |
BACKUP, CHANGEFEED, RESTORE, IMPORT | The job type to cancel. |
Examples
Cancel a single job
Cancel multiple jobs
To cancel multiple jobs, nest a that retrievesjob_id(s) inside the CANCEL JOBS statement:
maxroach will be cancelled.
Cancel by job type
To cancel all jobs by the type of job, use theCANCEL ALL {job} JOBS statement. You can cancel all BACKUP, RESTORE, CHANGEFEED, IMPORT jobs using this statement, for example:
Cancel automatic table statistics jobs
Canceling an automatic table statistics job is not useful since the system will automatically restart the job immediately. To permanently disable automatic table statistics jobs, disable thesql.stats.automatic_collection.enabled :
Cancel jobs for a schedule
To cancel jobs for a specific , use the schedule’sid:
id(s) inside the CANCEL JOBS statement:

