我正在尝试运行下面的 sql 查询,但经过长时间的等待后出现 505 错误。wp_posts 表包含超过 50,000 行...目的是删除大约 50,000 行的重复帖子
DELETE bad_rows.*
FROM wp_posts AS bad_rows
INNER JOIN
(
SELECT post_title, MIN(id) as min_id
FROM wp_posts
GROUP BY post_title
HAVING count(*) > 1
) AS good_rows
ON good_rows.post_title = bad_rows.post_title
AND good_rows.min_id <> bad_rows.id;
关于如何优化和运行的任何想法?