Is there a possibility of record failure in TiDB DDL_JOBS?

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: TIDB DDL_JOBS是否会出现记录失败的问题

| username: TIDB救我狗命

The DDL statements in my DDL_JOBS table are incomplete, with about 100 databases missing DDL records. I asked our company’s operations team, and they confirmed that DDL_JOBS has not been cleaned up. Is it possible for DDL_JOBS to have unsuccessful records?

Our company is currently working on an incremental data collection task. Due to various reasons, we cannot use TiCDC, so we are considering using DDL_JOBS to achieve incremental collection. Is this feasible? If DDL_JOBS loses data, then it won’t work.

| username: TIDB救我狗命 | Original post link

It’s my mistake. I found that the database names in DDL_JOBS are all in lowercase, which is why the records I queried were missing.

| username: ShawnYan | Original post link

Here, it should be a management standard issue. You can use all lowercase instead of mixing uppercase and lowercase.

Additionally, there should be no situation where the record fails. If there is, it’s a bug. In TiDB, DDL is first recorded in the queue before execution. If it is not recorded, it will not be executed.

| username: TIDB救我狗命 | Original post link

There is another question: Can I add an index to the DDL_JOBS table? Otherwise, the query speed is particularly slow. Are there any risks associated with adding an index?

| username: ShawnYan | Original post link

System tables cannot have indexes added. Try using WHERE to filter instead.

| username: ShawnYan | Original post link

You can also try this method,

It depends on what information you want to obtain.

| username: TIDB救我狗命 | Original post link

Okay, thank you!

| username: system | Original post link

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.