开发者

MySQL How to add a new multicolumn index to an innodb table without triggering a repair?

I have an innodb table that contains 70 million records and already has several single column indexes. I want to add a new multicolumn index that would allow me to run queries on multiple columns. I don't mind limited downtime (less than a day) but I want to avoid a repair with keycache or any other issues that might cause the addition of the new index to take a few days or weeks.

With the table being innodb, can the new index be added fairly quickly using CREATE INDEX, or would I need to back up the table and recover it to a new table with the desired indexes already added as is开发者_如何学编程 recommended for MyISAM tables? Or is there another strategy that is better suited to innodb?


Welcome to hell. I think you have two choices:

  1. suffer the downtime. Just to commiserate, I have a table with almost 400M rows..
  2. create a new table. Move your live app to that and then migrate your old data into it in batches.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜