what is the best way to Select
then Insert
large data into the Database (InnoDB Engine)?
I have got more than 60000 rows need to be inserted from another table without LIMIT
the result.
Is there a way to prevent my server memory being consumed too much or speed up the query? Could I split the query with let say LIMIT 5000
until its done copying all the data?
this is example query:
$query = 'SELECT * FROM orig_table WHERE user_id = 1 AND sent = 0'; // more than 60000 rows
if ( $query ) {
foreach ( $query as $row ) {
'INSERT INTO copy_table VALUE()';
}
}