I want to duplicate a very large table, but I do not want to copy it row by row. Is there any way to duplicate it?
For example, you can TRUNCATE without deleting a row / row, so I was wondering if there was something like this for copying entire tables
UPDATE: inserting line by line is very painful (due to 120M lines). Anyway, to avoid this?
MySQL no longer has the robust "copy table" feature - many reasons for this are related to how the data is stored. However, the following inserts row by row, but is pretty simple:
CREATE TABLE `new_table` LIKE `old_table`; INSERT INTO `new_table` (SELECT * FROM `old_table`);
INSERT INTO ... SELECT.
INSERT INTO ... SELECT
MyISAM, . , .
INSERT INTO TABLE2 SELECT * FROM TABLE1
; , , , .
InnoDB , , ... , , 120M , , , , , .
mysqldump, , , mysqldump . .
:
Create table t as select * from original_table