title: DDL_JOBS summary: 了解 information_schema 表 DDL_JOBS

DDL_JOBS

DDL_JOBS 表为 ADMIN SHOW DDL JOBS 命令提供了一个 INFORMATION_SCHEMA 接口。它提供了 TiDB 集群中 DDL 操作的当前状态和简短历史记录。

  1. USE information_schema;
  2. DESC ddl_jobs;
  1. +--------------+-------------+------+------+---------+-------+
  2. | Field | Type | Null | Key | Default | Extra |
  3. +--------------+-------------+------+------+---------+-------+
  4. | JOB_ID | bigint(21) | YES | | NULL | |
  5. | DB_NAME | varchar(64) | YES | | NULL | |
  6. | TABLE_NAME | varchar(64) | YES | | NULL | |
  7. | JOB_TYPE | varchar(64) | YES | | NULL | |
  8. | SCHEMA_STATE | varchar(64) | YES | | NULL | |
  9. | SCHEMA_ID | bigint(21) | YES | | NULL | |
  10. | TABLE_ID | bigint(21) | YES | | NULL | |
  11. | ROW_COUNT | bigint(21) | YES | | NULL | |
  12. | START_TIME | datetime | YES | | NULL | |
  13. | END_TIME | datetime | YES | | NULL | |
  14. | STATE | varchar(64) | YES | | NULL | |
  15. | QUERY | varchar(64) | YES | | NULL | |
  16. +--------------+-------------+------+------+---------+-------+
  17. 12 rows in set (0.00 sec)
  1. SELECT * FROM ddl_jobs LIMIT 3\G
  1. *************************** 1. row ***************************
  2. JOB_ID: 44
  3. DB_NAME: mysql
  4. TABLE_NAME: opt_rule_blacklist
  5. JOB_TYPE: create table
  6. SCHEMA_STATE: public
  7. SCHEMA_ID: 3
  8. TABLE_ID: 43
  9. ROW_COUNT: 0
  10. START_TIME: 2020-07-06 15:24:27
  11. END_TIME: 2020-07-06 15:24:27
  12. STATE: synced
  13. QUERY: CREATE TABLE IF NOT EXISTS mysql.opt_rule_blacklist (
  14. name char(100) NOT NULL
  15. );
  16. *************************** 2. row ***************************
  17. JOB_ID: 42
  18. DB_NAME: mysql
  19. TABLE_NAME: expr_pushdown_blacklist
  20. JOB_TYPE: create table
  21. SCHEMA_STATE: public
  22. SCHEMA_ID: 3
  23. TABLE_ID: 41
  24. ROW_COUNT: 0
  25. START_TIME: 2020-07-06 15:24:27
  26. END_TIME: 2020-07-06 15:24:27
  27. STATE: synced
  28. QUERY: CREATE TABLE IF NOT EXISTS mysql.expr_pushdown_blacklist (
  29. name char(100) NOT NULL,
  30. store_type char(100) NOT NULL DEFAULT 'tikv,tiflash,tidb',
  31. reason varchar(200)
  32. );
  33. *************************** 3. row ***************************
  34. JOB_ID: 40
  35. DB_NAME: mysql
  36. TABLE_NAME: stats_top_n
  37. JOB_TYPE: create table
  38. SCHEMA_STATE: public
  39. SCHEMA_ID: 3
  40. TABLE_ID: 39
  41. ROW_COUNT: 0
  42. START_TIME: 2020-07-06 15:24:26
  43. END_TIME: 2020-07-06 15:24:27
  44. STATE: synced
  45. QUERY: CREATE TABLE if not exists mysql.stats_top_n (
  46. table_id bigint(64) NOT NULL,
  47. is_index tinyint(2) NOT NULL,
  48. hist_id bigint(64) NOT NULL,
  49. value longblob,
  50. count bigint(64) UNSIGNED NOT NULL,
  51. index tbl(table_id, is_index, hist_id)
  52. );
  53. 3 rows in set (0.01 sec)