How to Quickly Rebuild Indexes

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

Original topic: 如何快速进行索引重建

| username: wluckdog

8133 - data inconsistency in table: t, index: idx_t_06, index-count:15053 != record-count:15050

Query time: 10.386s

For tables with data cleanup, after a large amount of data is deleted, there will be inconsistencies between the index and the table data. The current approach is to rebuild a new index and delete the old index.

Is there a way to quickly rebuild the index on the existing index? Because the table contains billions of rows, although there are ways to speed up index building by modifying parameters, it comes at the cost of affecting the current system’s IO.

| username: TiDBer_a0wVPNxf | Original post link

If this feature really exists, it will be very convenient for benchmarking. Looking forward to it.

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

Indeed, ADMIN RECOVER INDEX is single-threaded and too slow. If it could be modified to be like Oracle’s rebuild online with the ability to specify the number of parallel threads, I think it would be more reasonable…

| username: Fly-bird | Original post link

This is a great request.