MySQL中的复制全表到新表

来源:互联网 发布:java int 0x 编辑:程序博客网 时间:2024/06/01 09:41

两种方式

1、

create table new_table;

insert into new_table select * from old_table;


2、

create table new_table as select * from old_table;


性能比较


1、

mysql> create table t_1 like t_i;
Query OK, 0 rows affected (0.03 sec)

mysql> 
mysql> insert into t_1 select * from t_i;
Query OK, 956960 rows affected (28.39 sec)
Records: 956960  Duplicates: 0  Warnings: 0


2、

mysql> create table t_2 as select * from t_i;     
Query OK, 956960 rows affected (14.60 sec)
Records: 956960  Duplicates: 0  Warnings: 0


第二种完胜


另,本人参加了leader.us的MySQL Mycat培训教程,网上授课方式,嗯 ,里面的四位老师都是大神,有问题还可以问,顺便学习一下吹牛逼的本事得意。我是第一期,要开第二期了,有兴趣的话。。。加群313658990了解吧。


原创粉丝点击