Faster optimize table I have a 5TB+ MySQL database on RDS which I need to optimize. One particular table 1.5TB. We ran OPTIMIZE TABLE on this table in a separate RDS instance restored from a snapshot and the results were encouraging, but the command took 32 hours to run!

Is there a way to improve performance of the OPTIMIZE TABLE command? This table has 6 indexes other than the PK. I believe removing them will offer significant speedups. We plan to bump up the to the largest instance size RDS offers (r3.8xlarge) to help speed up the process. Are there any parameter groups I can tweak to improve the performance?
If you PARTITION the table (on anything), and have no more than, say, 30 partitions, then you could REBUILD each partition in about 3% of the total time, possibly a lot faster due to the size.  (Possibly following it with a ANALYZE PARTITION would be beneficial.)

Do not use 'optimize partition', that erroneously optimizes the entire table.

So, if you get enough reclaimed space to be worth it, set up a cron or EVENT to reorg one partition each night forever.

If you provide SHOW CREATE TABLE and some important queries, I may be able to advise on how to gain some other benefit from the partitioning.