Home > Database > Mysql Tutorial > body text

mysql千万级大表在线加索引

WBOY
Release: 2016-06-07 15:27:13
Original
2646 people have browsed it

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;



Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!