Issues with Creating Indexes and Foreign Keys

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

Original topic: 创建索引和外键的问题

| username: TiDBer_7Q5CQdQd

It took 10 hours to create an index for a table with 60 million records, and it still hasn’t finished. The hardware configuration is three machines with 8 cores and 16GB each.

The row_count has reached 200 million, far exceeding 60 million.

| username: zhanggame1 | Original post link

If the load is not high, you can modify the parameters tidb_ddl_reorg_worker_cnt and tidb_ddl_reorg_batch_size to speed up the index creation.

| username: tidb菜鸟一只 | Original post link

Is this table still being written to continuously?

| username: TiDBer_7Q5CQdQd | Original post link

No data written.

| username: TiDBer_7Q5CQdQd | Original post link

But why does the row_count exceed the actual data by three times?

| username: zhanggame1 | Original post link

Not sure, you can try this method to see if it works
Check TiDB → DDL related through Grafana monitoring

| username: cy6301567 | Original post link

How is the performance of the TiDB server? DDL operations will only be executed on one machine.

| username: cassblanca | Original post link

Does it count as three replicas? :joy:

| username: tidb菜鸟一只 | Original post link

Txn-merge is a transactional backfill that merges the temporary index with the original index upon completion of the backfill.

| username: system | Original post link

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