SHOW JOBS statement lists all of the types of long-running tasks your cluster has performed in the last 12 hours, including:
- Schema changes through
ALTER TABLE,DROP DATABASE,DROP TABLE, andTRUNCATE IMPORT.- Enterprise
BACKUPandRESTORE. - Scheduled backups.
- User-created table statistics created for use by the cost-based optimizer. To view automatic table statistics, use
SHOW AUTOMATIC JOBS.
SHOW JOBS statement. For details about enterprise changefeeds, including the sink URI 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 dropped tables and dropped indexes, and will execute after the GC TTL has elapsed. These jobs cannot be canceled.
- CockroachDB automatically retries jobs that fail due to retry errors or job coordination failures, with exponential backoff. The
jobs.registry.retry.initial_delaycluster setting sets 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
CONTROLJOBrole option. - For changefeeds, users with the
CHANGEFEEDprivilege 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 crdb_internal.jobs table. The jobs.retention_time cluster setting defines how long jobs will be retained in the crdb_internal.jobs table. When CockroachDB checks the jobs table, it will garbage collect 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 garbage collection, or potential data accumulation in the case of changefeeds. See Monitoring paused jobs for detail on metrics to track paused jobs and protected timestamps.
Examples
Show jobs
Filter jobs
You can filter jobs by usingSHOW JOBS as the data source for a SELECT 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 zone configurations (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 storage layer 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.maxcluster setting. Both tables contribute to thecrdb_internal.statement_statisticsandcrdb_internal.transaction_statisticstables, respectively.AUTO CREATE STATS: Creates and updates table statistics.
Filter automatic jobs
You can filter jobs by usingSHOW AUTOMATIC JOBS as the data source for a SELECT statement, and then filtering the values with the WHERE clause.
Show changefeed jobs
You can display specific fields relating to changefeed jobs by runningSHOW CHANGEFEED JOBS. These fields include:
high_water_timestamp: Guarantees all changes before or at this time have been emitted.- New in v25.1:
readable_high_water_timestamptz: Thehigh_water_timestampvalue inTIMESTAMPTZformat for readability. sink_uri: The destination URI of the configured sink for a changefeed.full_table_names: The full name resolution for a table. For example,defaultdb.public.mytablerefers to thedefaultdbdatabase, thepublicschema, and the tablemytable.topics: The topic name to which Kafka and Google Cloud Pub/Sub changefeed messages will emit. If you start a changefeed with thesplit_column_familiesoption targeting a table with multiple column families, theSHOW CHANGEFEED JOBSoutput will show the topic name with a family placeholder. For example,topic.{family}.format: 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 Response section.
Filter changefeed jobs
You can filter jobs by usingSHOW CHANGEFEED JOBS as the data source for a SELECT 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 SELECT 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 backup schedule, use the schedule’sid:
SELECT clause that retrieves id(s) inside the SHOW JOBS statement:

