TiDB 大量数据创建索引速度太慢

我们业务的一张表有 600 亿条数据,要在上面新创建一条索引。下面是 ADMIN DDL 的信息:

| 55         | 5a6dfc92-4d52-49dd-ab9d-59ff7ec05e89 | 10.x.x.x:4000 | ID:78, Type:add index, State:running, SchemaState:write reorganization, SchemaID:43, TableID:60, RowCount:62194555, ArgLen:0, start time: 2019-12-26 09:36:47.473 +0800 CST, Err:<nil>, ErrCount:0, SnapshotVersion:413486077332160514 | eecbeccd-1259-49f4-931a-3c48bc642dcd | create index uid_idx on g_xxx (uid) |

根据 start time 和当前时间在加 RowCount 计算,这个索引加完得1个月,有什么办法可以加快这个进程吗?

https://pingcap.com/docs-cn/stable/reference/configuration/tidb-server/tidb-specific-variables/#tidb_ddl_reorg_worker_cnt

可以调整这两个参数 tidb_ddl_reorg_worker_cnttidb_ddl_reorg_batch_size

可以贴一下修改前后的admin ddl信息吗? 顺便写一下你修改的值,看看效果