问题描述;
1.表规模是 150万行,每行18列。 执行查询语句:
selectcount(DeviceId) from(select DeviceId, count(distinct SubdeviceMac) as MACnumfrom wide_table_all_row where TIMESTAMPP LIKE "%2017-10-13%" group by DeviceId HAVING MACnum >= 5 and MACnum <= 10) as tmp;
报Error Code: 2013. Lost connectionto MySQL server during query。 每次都是等待30s报错误。
按照网上的经验,修改mysql服务器的配置文件,my.ini的timeout时间,发现问题仍然存在。
后来换mysql安装自带的cmd命令行客户端,没有超时问题。 怀疑是mysql workbench 客户端原因。
后来再MySQL workbench Q&A找到原因,链接如下 https://dev.mysql.com/doc/workbench/en/workbench-faq.html#faq-workbench-error-lost-connection
Yes, go to Preferences, SQL
Editor, and adjust the DBMS
connection read time out option
that defaults to 600 seconds. This sets the maximum amount of time (in seconds) that a query can take before MySQL Workbench disconnects from the MySQL server.
通过修改红色字体的值,并重启启动workbench 生效(一定要重启哦!)。