fastest way to copy a table in mysql

Posted by Anon on Stack Overflow See other posts from Stack Overflow or by Anon
Published on 2010-05-31T12:09:04Z Indexed on 2010/05/31 12:12 UTC
Read the original article Hit count: 206

Filed under:
|

which one is the fastest way to completely copy a table on mysql ?

CREATE TABLE copy LIKE original;
INSERT INTO copy SELECT * FROM original;

or

CREATE TABLE copy SELECT * FROM original;
ALTER TABLE copy ADD PRIMARY KEY (id);

or theres another way ?

PS. can't use command-line tools like mysqldump, must be on-the-fly.

© Stack Overflow or respective owner

Related posts about sql

Related posts about mysql