How to Troubleshoot When Creating an Index on an Empty Partitioned Table Hangs

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

Original topic: 空分区表建立索引hang住了怎么排查

| username: dxss-lee

TiDB version 6.1
Session 1 is creating an index on a table with 1 billion rows.
Session 2 is creating an index on an empty partitioned table.
Session 2 is taking a very long time to complete. How can I determine what resources session 2 is waiting for?

| username: 啦啦啦啦啦 | Original post link

When multiple DDL statements are executed together, the latter DDL statements will be relatively slow. The reason is that in the current TiDB cluster, DDL operations are executed serially.

| username: xfworld | Original post link

Check the status of DDL JOB

Because it is asynchronous and also serial, it is relatively slow… Keep an eye on the status.

| username: 张雨齐0720 | Original post link

You can check the execution status of DDL.

In TiDB’s architecture design, DDL is placed in a queue and executed in turn by multiple owners in a serial manner. Therefore, you can open another session to check the status of the executing job and make a judgment.

In our production environment, we have records of adding indexes that took more than 24 hours to execute.

So you can take a look.

| username: luqiuhua | Original post link

First, check what the previous poster mentioned, admin show ddl jobs to view the progress status of the DDL. If you want to speed it up, you can modify the parameter:
SET GLOBAL tidb_ddl_reorg_worker_cnt=16; This temporarily and dynamically adjusts the concurrency, increasing the index addition speed by a hundredfold.
This parameter defaults to 4.

| username: cs58_dba | Original post link

During off-peak business hours, manually adjust parameters to speed up index creation.

| username: HACK | Original post link

Add parameters to increase the speed of index creation.

| username: ablewang_xiaobo | Original post link

Thumbs up, I did it this way before.

| username: system | Original post link

This topic was automatically closed 1 minute after the last reply. No new replies are allowed.