I try to transfer a huge amount of data (around 200k records every few minutes) from one to another database (also on two different servers). The tableschema on both tables is both dbs is the same.
So whats the best way to transfer a huge resultset into a db without causing an memory limit error.
my current solution looks like this. But this means I run about 200k Insert querys in writeToDB2()
and that seems to be not very effective to me.
$stmt = $this->db_1->query("SELECT foo from bar");
while($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
writeToDB2($row);
}
Does anyone knew a better solution to bulk transfer the data?