两种方式
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了解吧。