We have a 8 million row MySQL table. We want to prune about 2m rows from it, remove some outdated indexes and add new ones. To achieve almost no downtime, our plan is to create a clone of the table (and lock the original), run a script (Ruby) to prune the data that we don't need anymore and finally add the new indexes. Then we would put up the maintenance page on the web app, swap their names (by renaming the tables) and restart the app.
Is this the best way to achieve our final results? Any other tips/suggestions from people that have some something similar to this before? Whats the best way (super cool secret mysql cmds) to clone the table? Best/quickiest way to mass delete rows?