これは私の前の質問へのフォローアップの質問です。
以下のコードを使用してデータベース テーブルを複製しますが、テーブル サイズが大きい場合、スクリプトがハングしてページが待機し続けることがあります。両方のテーブルの行数を比較すると、次のようなものが見つかります。
元のテーブル数: 855057
バックアップされたテーブル数: 855022
プロセスが完全に完了していないようで、挿入ステートメントの実行中にスタックしたのはなぜですか?
ほとんどの場合、両方とも実際には同じにカウントされますが、複製が終了してもハングすることに注意してください。
これが私のコードです:
//duplicate tables structure
$query = "CREATE TABLE $this->dbName.`$newTableName` LIKE $this->dbName.`$oldTable`";
..
..
//duplicate tables data
$query = "INSERT INTO $this->dbName.`$newTableName` SELECT * FROM $this->dbName.`$oldTable`";
..
..
ps。ローカルホストから複製スクリプトを実行して、リモートサーバーにあるデータベースをバックアップします。