mysql千万级大表在线加索引



create table tmp like paper_author;
ALTER TABLE tmp ADD INDEX ( `PaperID` )

insert into tmp(ooo,...)  select  ooo,... from paper_author
Query OK, 35510600 rows affected (9 min 24.99 sec)
Records: 35510600  Duplicates: 0  Warnings: 0

RENAME TABLE paper_author TO tmp2, tmp to paper_author;

drop table tmp2;



你可能感兴趣的:(数据库)