What is the best way to copy a large MySQL table in terms of speed and memory ?
Option 1 .. Using PHP, select X rows from the old table and paste them into the new table. Continue to the next iteration of select / insert until all entries are copied.
Option 2. Use MySQL INSERT INTO ... SELECT without row restrictions.
Option 3. Use MySQL INSERT INTO ... SELECT with a limited number of rows copied per run.
EDIT: I will not use mysqldump. The purpose of my question is to find the best way to write a database conversion program. Some tables have changed, some have not. I need to automate the whole copy / conversion copy process without worrying about manually dropping any tables. Therefore, it would be helpful if you could answer which of the above options is better.
source share