我需要通过更改注释状态(将读取和读取/写入变为禁用)来更新50K记录,并希望确保我的SQL语句正确无误:
$query = "UPDATE node.nid AS nid, node.comment AS node_comment, node.type AS node_type
SET node.comment = '0'
WHERE (node.type in ('article', 'blog', 'event'))
AND (node.comment in ('1','2'))";
$total = 0;
$count = 0;
while ($query_result = db_query($query)){
$count++;
$total++;
if($count>200){
$count = 0;
sleep(300);
}
}
echo "Updated records:" . $total;
我在那里添加了一个周期性的暂停,所以它不会杀死服务器。这看起来不错吗?
答案 0 :(得分:0)
我将UPDATE更改为只是节点节点,并且工作正常。