Have a question about CiviCRM? Get it answered quickly at the new CiviCRM Stack Exchange Q+A siteThis forum was archived on 25 November 2017. Learn more.How to get involved.What to do if you think you've found a bug.
create new_db.old_activity_history like old_db.civicrm_activity_history;
use new_db;-- the primary key is also auto_increment, so you need to remove-- this before you can proceedalter table old_activity_history modify id int(10) unsigned;-- remove the primary key itselfalter table old_activity_history drop PRIMARY KEY;-- remove the regular indexesalter table old_activity_history drop index index_entity;alter table old_activity_history drop index index_activity;-- and the foreign key indexes as wellalter table old_activity_history drop index FK_civicrm_activity_history_relationship_id;alter table old_activity_history drop index FK_civicrm_activity_history_group_id;
alter table old_activity_history engine = archive;
insert into old_activity_history select * from old_db.civicrm_activity_history;
select max(id) from old_db.civicrm_activity_history into @ah_max_id;
truncate old_db.civicrm_activity_history;
insert into old_db.civicrm_activity_history select * from old_activity_history where id = @ah_max_id;
Another easier option might be to wait for an official MySQL 5.1 release and use the partitioning feature: http://dev.mysql.com/tech-resources/articles/performance-partitioning.html