gpt4 book ai didi

mysql - 删除查询 "ERROR 2006 (HY000): MySQL server has gone away"

转载 作者:可可西里 更新时间:2023-11-01 07:44:45 26 4
gpt4 key购买 nike

总结:

我在 P-table 中有 250 万行,在 J-table 中有 100,000 行。我试图从 P 表中删除与 J 表无关的所有行。

预期结果:

缺少关系的每一行(大约 100 000 个有关系) 将从 P 表中删除。

我正在使用的查询:

DELETE P 
FROM P
LEFT JOIN J ON J.P_id = P.id
WHERE J.id IS NULL;

我收到的错误:

ERROR 2006 (HY000): MySQL server has gone away

我尝试了什么:

SET innodb_lock_wait_timeout=63000;
SET wait_timeout=63000;

/* ... followed by the query stated above ... */

问题

我怎样才能达到预期的结果?


编辑

附加信息 - 进程列表

所以我猜查询仍在运行..

+-----+------+-----------+---------+---------+-------+--------------+------------------------------------------------------------------------------------------------------+
| Id | User | Host | db | Command | Time | State | Info |
+-----+------+-----------+---------+---------+-------+--------------+------------------------------------------------------------------------------------------------------+
| 540 | root | localhost | scraper | Query | 63298 | Sending data | DELETE Domain_Page FROM Domain_Page LEFT JOIN StructuredData_Joppli ON StructuredData_Joppli.Domain_ |
| 556 | root | localhost | scraper | Query | 0 | NULL | show processlist |
+-----+------+-----------+---------+---------+-------+--------------+------------------------------------------------------------------------------------------------------+

最佳答案

改变这个

 DELETE P
FROM P

 DELETE 
FROM P

关于mysql - 删除查询 "ERROR 2006 (HY000): MySQL server has gone away",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23733122/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com