栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

查询大表时查询进程被killed 本地内存被占满

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

查询大表时查询进程被killed 本地内存被占满

[c-dag002 pang]$ mysql -hprod-ai.mysql.rds.aliyuncs.com -P5000 -udba -pdq4Xy -D device -e "select *  from t_tencent_statistic  where create_time < '2022-05-14 00:00:00' " > t_tencent_statistic.txt
mysql: [Warning] Using a password on the command line interface can be insecure.
Killed
[cloud-user@m2m-ags-biz-dag002 pang]$ free -h
              total        used        free      shared  buff/cache   available
Mem:            45G         30G         12G        2.8M        2.8G         15G
Swap:            0B          0B          0B
[clous-biz-dag002 pang]$ mysql -hprod-ai.mysql.rds.aliyuncs.com -P5000 -udba -pJqdq4 -D device --quick -e "select *  from t_tencent_statistic  where create_time < '2022-05-14 00:00:00' " > t_tencent_statistic.txt
mysql: [Warning] Using a password on the command line interface can be insecure.

[cloud-user@m2m-ags-biz-dag002 ~]$ free -h
              total        used        free      shared  buff/cache   available
Mem:            45G         30G        281M        2.9M         15G         15G
Swap:            0B          0B          0B
[cloud-user@m2m-ags-biz-dag002 ~]$ free -h
              total        used        free      shared  buff/cache   available
Mem:            45G         30G        285M        2.9M         15G         15G
Swap:            0B          0B          0B
[cloud-user@m2m-ags-biz-dag002 ~]$ cd pang/

当查询大表时,本地服务器上的内存被占满时,查询进程会备份系统kill 掉。

解决方法就是 使用  --quick 参数  该参数确保内存不被占满。

By default the entire result set is fetched in memory. If that becomes to much, the mysql client will be killed. You can start the mysql client with the --quick option to prevent this:

   mysql --quick -uname -ppwd wmap -e  ... 

Share

Follow

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/964928.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号