当前位置:Gxlcms > mysql > mysql千万级大表在线加索引

mysql千万级大表在线加索引

时间:2021-07-01 10:21:17 帮助过:184人阅读

create table tmp like paper_author; ALTER TABLE tmp ADD INDEX ( `PaperID` ) insert into tmp(ooo,...) selectooo,... from paper_author Query OK, 35510600 rows affected (9 min 24.99 sec) Records: 35510600 Duplicates: 0 Warnings: 0 RENAME TAB



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;

人气教程排行