PAUSE JOB

On this page Carat arrow pointing down
Warning:
CockroachDB v20.1 is no longer supported as of November 12, 2021. For more details, refer to the Release Support Policy.

The PAUSE JOB statement lets you pause IMPORT jobs, enterprise BACKUP and RESTORE jobs, user-created table statistics jobs, automatic table statistics jobs, changefeeds, and schema change jobs.

After pausing jobs, you can resume them with RESUME JOB.

Required privileges

By default, only the root user can control a job.

Synopsis

PAUSE JOB job_id JOBS select_stmt

Parameters

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

Examples

Pause a single job

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

Pause multiple jobs

To pause multiple jobs, nest a SELECT clause that retrieves job_id(s) inside the PAUSE JOBS statement:

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

All jobs created by maxroach will be paused.

Pause automatic table statistics jobs

icon/buttons/copy
> SHOW AUTOMATIC JOBS;
        job_id       |       job_type      |                    description                      |...
+--------------------+---------------------+-----------------------------------------------------+...
  438235476849557505 | AUTO CREATE STATS   | Table statistics refresh for defaultdb.public.users |...
(1 row)
icon/buttons/copy
> PAUSE JOB 438235476849557505;

To permanently disable automatic table statistics jobs, disable the sql.stats.automatic_collection.enabled cluster setting:

icon/buttons/copy
> SET CLUSTER SETTING sql.stats.automatic_collection.enabled = false;

See also


Yes No
On this page

Yes No