When I was trying TiDB, I ran into the condition that it was slow to add indexes. I want to view the progress, but how to view the DDL jobs in TiDB?
2 Answers
Show DDL Jobs: You can use the SHOW DDL JOBS statement to view the status and progress of ongoing DDL jobs. This statement provides information such as job ID, schema name, table name, type of operation, start time, and state of the DDL job. Here's an example:
SHOW DDL JOBS;
Information Schema: You can query the INFORMATION_SCHEMA.JOBS table to get detailed information about the DDL jobs. This table contains columns such as JOB_ID, SCHEMA_NAME, TABLE_NAME, TYPE, STATE, START_TIME, and more. Here's an example:
SELECT * FROM INFORMATION_SCHEMA.JOBS;
TiDB Dashboard: If you have TiDB Dashboard installed and configured, you can access it through a web browser to view the progress of DDL jobs. TiDB Dashboard provides a graphical interface to monitor and manage your TiDB cluster, including DDL job information.

- 9
- 2
You can use admin show ddl
to view the current job of adding an index or the running DDL jobs.
As for viewing DDL jobs, you can also use two other commands as follows:
admin show ddl jobs
: to view all the results in the current DDL job queue (including tasks that are running and waiting to run) and the last ten results in the completed DDL job queueadmin show ddl job queries 'job_id' [, 'job_id'] ...
: to view the original SQL statement of the DDL task corresponding to thejob_id
; thejob_id
only searches the running DDL job and the last ten results in the DDL history job queue

- 151
- 1
- 10