Can TiDB Modify Indexes and How Efficient Is It?

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

Original topic: TIDB可以修改索引吗,效率如何

| username: 小于同学

Can TiDB modify indexes, and how is the efficiency?

| username: zhanggame1 | Original post link

It won’t work, delete and recreate it.

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

You cannot modify it, you can only delete and recreate it.
ALTER TABLE table_name DROP INDEX index_name;
ALTER TABLE table_name ADD INDEX index_name(column_name);

| username: 小于同学 | Original post link

What if there is data?

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

If there is a lot of table data, it is recommended to do it during off-peak business hours to avoid affecting normal business queries.

| username: yulei7633 | Original post link

In MySQL, it is also deleted and recreated, and in TiDB, it is also deleted and recreated.

| username: zhaokede | Original post link

The rebuild speed depends on performance and data size; single-field indexes are generally very fast.

| username: system | Original post link

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