Update sur de tres grosses tables

CREATE TABLE `sbtest2` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`k` int(10) unsigned NOT NULL DEFAULT '0',
`c` char(120) NOT NULL DEFAULT '',
`pad` char(60) NOT NULL DEFAULT '',
`c2` char(120) NOT NULL DEFAULT '',
`pad2` char(60) NOT NULL DEFAULT '',
PRIMARY KEY (`id`),
KEY `k` (`k`)
) ENGINE=InnoDB AUTO_INCREMENT=20000001 DEFAULT CHARSET=latin1;

alter table sbtest2 disable keys;
insert into sbtest2 select id,k,c,upper(pad),c2,pad2 from sbtest;
/* rebuild index*/
alter table sbtest2 enable keys;
alter table sbtest2 engine='InnoDB';

Publicités