我正在尝试以这种方式更新一些大表:
<?php
$tables = array("table1","table2","table3","table4","table5");
foreach ($tables as $table) {
$res = mysql_query("SELECT * FROM {$table}");
while($row = mysql_fetch_array($res)){
$data = $row['data'];
$data = gmdate('Y-m-d H:i:s', strtotime($data));
mysql_query("UPDATE {$table} SET data='$data' WHERE user_id='".$row['user_id']."'";);
}
}
?>
每个表大约有 80.000 行,处理过程将花费太多时间来完成。我如何使用gmdate
mysql 中的等效函数来解决这个问题?谢谢!:)