SHOW JOBS lists all of the types of long-running tasks your cluster has performed in the last 12 hours, including:
- Schema changes through , , , and
- .
- Enterprise and .
- .
- created for use by the . To view , use
SHOW AUTOMATIC JOBS.
SHOW JOBS statement. For details about , including the and the full table name, use SHOW CHANGEFEED JOBS.
To block a call to SHOW JOBS that returns after all specified job ID(s) have a terminal state, use SHOW JOBS WHEN COMPLETE. The statement will return a row per job ID, which provides details of the job execution. Note that while this statement is blocking, it will time out after 24 hours.
Considerations
- The
SHOW JOBSstatement shows only long-running tasks. - While the
SHOW JOBS WHEN COMPLETEstatement is blocking, it will time out after 24 hours. - Garbage collection jobs are created for and , and will execute after the has elapsed. These jobs cannot be canceled.
- CockroachDB automatically retries jobs that fail due to or job coordination failures, with exponential backoff. The
jobs.registry.retry.initial_delaysets the initial delay between retries andjobs.registry.retry.max_delaysets the maximum delay.
Required privileges
You must have at least one of the following to runSHOW JOBS:
- The
VIEWJOBprivilege, which can view all jobs (includingadmin-owned jobs). - Be a member of the
adminrole. - The .
- For changefeeds, users with the privilege on a set of tables can view changefeed jobs running on those tables.
Synopsis
Parameters
Response
The output ofSHOW JOBS lists ongoing jobs first, then completed jobs within the last 12 hours. The list of ongoing jobs is sorted by starting time, whereas the list of completed jobs is sorted by finished time.
To view details for jobs older than 12 hours, you can query the table. The jobs.retention_time defines how long jobs will be retained in the crdb_internal.jobs table. When CockroachDB checks the jobs table, it will jobs details for any completed job that has reached the configured retention time. The default value of jobs.retention_time is 14 days.
The following fields are returned for each job:
For details of changefeed-specific responses, see
SHOW CHANGEFEED JOBS.
Job status
We recommend monitoring paused jobs to protect historical data from , or potential data accumulation in the case of . See for detail on metrics to track paused jobs and .
Examples
Show jobs
Filter jobs
You can filter jobs by usingSHOW JOBS as the data source for a statement, and then filtering the values with the WHERE clause.
Show automatic jobs
AUTO SPAN CONFIG RECONCILIATION: A continuously running job that ensures that all declared (ALTER … CONFIGURE ZONE …) are applied. For example, whennum_replicas = 7is set on a table, the reconciliation job listens in on those changes and then informs the underlying to maintain 7 replicas for the table.AUTO SQL STATS COMPACTION: An hourly job that truncates the internalsystem.statement_statisticsandsystem.transaction_statisticstable row counts to the value of thesql.stats.persisted_rows.max. Both tables contribute to the and tables, respectively.AUTO CREATE STATS: Creates and updates .
Filter automatic jobs
You can filter jobs by usingSHOW AUTOMATIC JOBS as the data source for a statement, and then filtering the values with the WHERE clause.
Show changefeed jobs
You can display specific fields relating to jobs by runningSHOW CHANGEFEED JOBS. These fields include:
- : Guarantees all changes before or at this time have been emitted.
readable_high_water_timestamptz: Thehigh_water_timestampvalue in format for readability.- : The destination URI of the configured sink for a changefeed.
full_table_names: The full for a table. For example,defaultdb.public.mytablerefers to thedefaultdbdatabase, thepublicschema, and the tablemytable.topics: The topic name to which and changefeed messages will emit. If you start a changefeed with the option targeting a table with , theSHOW CHANGEFEED JOBSoutput will show the topic name with a family placeholder. For example,topic.{family}.- : The format of the changefeed messages, e.g.,
json,avro.
SHOW CHANGEFEED JOBS will return all changefeed jobs from the last 12 hours. For more information on the retention of job details, refer to the Response section.
Filter changefeed jobs
You can filter jobs by usingSHOW CHANGEFEED JOBS as the data source for a statement, and then filtering the values with a WHERE clause. For example, you can filter by the status of changefeed jobs:
SHOW CHANGEFEED JOBS displays using a SELECT statement:
Show schema changes
You can show just schema change jobs by usingSHOW JOBS as the data source for a statement, and then filtering the job_type value with the WHERE clause:
Show job when complete
To blockSHOW JOB until the provided job ID reaches a terminal state, use SHOW JOB WHEN COMPLETE:
Show jobs for a schedule
To view jobs for a specific , use the schedule’sid:
id(s) inside the SHOW JOBS statement:

