Home >Database >Mysql Tutorial >mysql千万级大表在线加索引

mysql千万级大表在线加索引

WBOY
WBOYOriginal
2016-06-07 15:27:132709browse

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;



Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn