Creating Index Keeps Running Without Completion

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

Original topic: 建立索引一直运行,没有建立完成

| username: TiDBer_7Q5CQdQd

Three machines, each with 8 cores and 16GB of RAM. Before creating the index, there was 7GB of memory remaining. It has already been running for over 10,000 seconds.

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

admin show ddl jobs take a look

| username: zhanggame1 | Original post link

Let’s first talk about the number of records in this table.

| username: TiDBer_7Q5CQdQd | Original post link

| username: TiDBer_7Q5CQdQd | Original post link

More than 61 million

| username: 像风一样的男子 | Original post link

The row_count is over 100 million.

| username: TiDBer_7Q5CQdQd | Original post link

Why hasn’t it ended yet?

| username: 像风一样的男子 | Original post link

Count the number of rows in your table and then refresh the admin show ddl jobs to check the progress.

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

The number of rows is inaccurate. You have 60 million, and this column is estimated to need 120 million to complete. It looks like you already have over 100 million, so it should be soon. Next time, I suggest modifying the parameters before creating the index.

| username: TiDBer_7Q5CQdQd | Original post link

Why is it 120 million? Is there any calculation method?

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

No, I was wrong above. Creating an index should be fairly accurate, but modifying a column will be twice the size of the source table.