PAUSE JOB lets you pause the following types of jobs:
- jobs
- and jobs
- jobs
- jobs
- jobs
- jobs
If a schema change job is paused, any jobs waiting on that schema change will stop waiting and return an error.
Required privileges
To pause a job, the user must be a member of theadmin role or must have the set. Non-admin users cannot pause admin users’ jobs.
For changefeeds, users with the privilege on a set of tables can pause changefeed jobs running on those tables.
Synopsis
Pause all jobs by type
Parameters
| Parameter | Description |
|---|---|
job_id | The ID of the job you want to pause, which can be found with . |
select_stmt | A that returns job_id(s) to pause. |
for_schedules_clause | The schedule you want to pause jobs for. You can pause jobs for a specific schedule (FOR SCHEDULE id) or pause jobs for multiple schedules by nesting a in the statement (FOR SCHEDULES <select_clause>). See the examples below. |
WITH REASON = ... | The reason to pause the job. CockroachDB stores the reason in the job’s metadata, but there is no way to display it. |
BACKUP, CHANGEFEED, RESTORE, IMPORT | The job type to pause. |
Monitoring paused jobs
We recommend monitoring paused jobs. Jobs that are paused for a long period of time can start to affect the cluster in the following ways:- A paused , , or index backfill job () will continue to hold a record on the data the job is operating on. This could result in data accumulation as the older versions of the keys cannot be . In turn, this may cause increased disk usage and degraded performance for some workloads. See for more detail.
- A paused job, if is set, will also hold a protected timestamp record on the data the job is operating on. Depending on the value of , this can lead to data accumulation. Once
gc_protect_expires_afterelapses, the protected timestamp record will be released and the changefeed job will be canceled. See for more detail.
jobs.{job_type}.currently_paused metric to track the number of jobs (for each job type) that are currently considered paused.
You can monitor protected timestamps relating to particular CockroachDB jobs with the following metrics:
jobs.{job_type}.protected_age_sectracks the oldest protected timestamp record protecting jobs. As this metric increases, garbage accumulation increases. Garbage collection will not progress on a table, database, or cluster if the protected timestamp record is present.jobs.{job_type}.protected_record_counttracks the number of protected timestamp records held by jobs.
Examples
Pause a single job
Pause multiple jobs
To pause multiple jobs, nest a that retrievesjob_id(s) inside the PAUSE JOBS statement:
maxroach will be paused.
Pause by job type
To pause all jobs by the type of job, use thePAUSE ALL {job} JOBS statement. You can pause all BACKUP, RESTORE, CHANGEFEED, IMPORT jobs using this statement, for example:
Pause automatic table statistics jobs
sql.stats.automatic_collection.enabled :
Pause jobs for a schedule
To pause jobs for a specific , use the schedule’sid:
id(s) inside the PAUSE JOBS statement:

