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:
- suffer the downtime. Just to commiserate, I have a table with almost 400M rows..
- create a new table. Move your live app to that and then migrate your old data into it in batches.
精彩评论