2 つの異なるサーバー (db1、db2) に 2 つのデータベースがあります。あるテーブルから別のテーブルにデータを転送したい: copy from db1.mytable to
db2.mytable
A: db1.mytable から多数の行を選択し、小さなバッチで db2.mytable に送信します。
B: ループ ( db1.mytable から少数の行を選択し、それらすべてを 1 つのバッチで db2.mytable に挿入します)
例:
A:
SELECT * FROM mytable LIMIT 200000;
while(not_all_fetched)
{
fetch 1000 rows;
insert these 1000 rows into db2.mytable;
}
B:
while(more_rows_to_copy)
{
SELECT * FROM mytable LIMIT 1000;
fetch all of them;
insert these 1000 rows into db2.mytable
}