当前位置:   article > 正文

MySQL8.0.25问题(WITH,UNION ALL,窗口函数,聚合函数的组合,可能导致执行报错“Lost connection to MySQL server during query“)_the last packet successfully received from the ser

the last packet successfully received from the server was 80,604,321 millise

【问题如下】

有一段WITH查询的SQL,最后的SELECT中含聚合函数SUM和UNION ALL,上一层查询RESULT_DETAIL中还用到了窗口函数OVER(),执行报错
sqlyog工具中执行报错:Lost connection to MySQL server during query
JAVA程序里执行报错:The last packet successfully received from the server was 8,321 milliseconds ago. The last packet sent successfully to the server was 8,322 milliseconds ago.; nested exception is com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure
在这里插入图片描述

【检查过程】

1、该SQL在几个8.0.25版本的MySQL数据库中执行,均报错,在8.0.26,8.0.28版本的数据库中执行正常,均没有报错;
(以下在8.0.25版本中执行)
2、去掉RESULT_DETAIL中的窗口函数OVER(),写成 1 AS RN,不再报错;
3、保留窗口函数,去掉最后的UNION ALL以及SUM,直接SELECT * FROM RESULT_DETAIL ,不再报错。

【解决方法】

将MySQL数据库,从8.0.25升级到8.0.28,问题解决。

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/很楠不爱3/article/detail/159629
推荐阅读
相关标签
  

闽ICP备14008679号