首頁 >資料庫 >mysql教程 >mysql千万级大表在线加索引

mysql千万级大表在线加索引

WBOY
WBOY原創
2016-06-07 15:27:132714瀏覽

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;



陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn