我在更新wp_post时收到'查询执行被中断'错误?

时间:2014-01-28 06:04:41

标签: mysql wordpress

我在更新wp_post时收到#1317 - Query execution was interrupted错误消息。我的数据库中这个表的大小约为429MB。我正在运行以下查询。

UPDATE wp_posts SET comment_status = 'open', ping_status = 'open' WHERE comment_status = 'closed';

我无法更新数据库请帮忙。 感谢。

1 个答案:

答案 0 :(得分:1)

通常情况下,这不是他们会让你做的事情。你可以做些什么来解决它是将你的更新语句分解成更小的块,使用表中的某些字段不会超时。您可以使用日期或主键。 wp_postsan auto_increment primary key,因此您可以根据它进行分解。

运行select max(id) from wp_posts以查看总共有多少帖子。找出一种合理的方法来分解它们,每1000或2000等。

然后再次运行您的更新语句,但过滤ID即:where id < 1000然后where (id >= 1000 and id < 2000)

看起来像这样:

UPDATE wp_posts SET comment_status = 'open', ping_status = 'open' WHERE comment_status = 'closed' and id < 1000;