Instead of un-and re-compressing history tables: If you want to access a single table for history, you can use a merge table to join read-only compressed history tables.
Thus, assuming you have an active table and compressed history tables with the same table structure, you can use the following scheme:
Tables:
compressed_month_1 compressed_month_2 active_month
Create a merge table:
create table history_merge like active_month; alter table history_merge ENGINE=MRG_MyISAM union (compressed_month_1,compressed_month_2);
After a month, compress the table active_month and rename it to compressed_month_3 . Now the following tables:
compressed_month_1 compressed_month_2 compressed_month_3 active_month
and you can update the history table
alter table history_merge union (compressed_month_1, compressed_month_2, compressed_month_3);
Ruben source share