当前位置:网站首页>pt-kill 查询中包含中文字符 导致工具失效的排查
pt-kill 查询中包含中文字符 导致工具失效的排查
2022-07-28 09:59:00 【二狗不要跑】
生产环境遇到几个YearningSQL平台触发的慢查询(该sql产生的笛卡尔积太大,出不来结果,研发在前端界面再次触发查询),最终把数据库的CPU拖高的情况。
DBA紧急介入后,根据mysql服务器上show full processlist抓取到相关sql,执行时间已经超过120s。先记录下现场,然后kill掉相关query。
query类似如下:
select
aa AS A列,
bb as B列
FROM sbtest.sbtest1
where aa = 'abcdefg'
order by update_time desc
LIMIT 100;对比了下后台操作日志,确认这就是研发同学在YearningSQL查询界面多次提交的query。
但是,我们几个月前就上线了pt-kill 定时任务,针对于YearningSQL平台的用户查询做了60秒的查询超时熔断。理论上即便出现这类慢sql也不会执行时间过长。
查了下pt-kill 的最近日志,发现里面有一些提示:
Wide character in print at pt-kill line 7373
翻下对应的代码段,如下部分:
根据上面的sql,基本可以判断是perl脚本执行过程中遇到中文字符处理失败导致的。
找到了原因,解决方法也很简单:
在pt-kill的文件头部,加2行代码:
use utf8;
use open ":encoding(utf8)",":std";另外对于一些复杂的查询,有些建议给到研发同学:
1、执行前建议先explain自行评估下
2、查询中,可以显式定义60秒超时时间,例如 SELECT /*+ MAX_EXECUTION_TIME(60000) */ * FROM t1 INNER JOIN t2 WHERE ... 【5.7及以上版本生效】
边栏推荐
- 【JS高级】js之函数、重载、匿名函数、作用域及作用域链_03
- Being on duty less than 8 hours a day and being dismissed? Tencent's former employees recovered 13million overtime pay, etc., and the court won a compensation of 90000 in the final judgment
- Sort - quick sort (fast and slow pointer Implementation)
- Redis面试题必知必会
- Skiasharp's WPF self drawn drag ball (case version)
- Leetcode -- minimum number of rotation array
- Description of landingsite electronic label quppa firmware entering DFU status
- 漏洞分析丨HEVD-0x8.IntegerOverflow[win7x86]
- Holy Grail of web and double wing layout, float, clear, both
- Kubernetes
猜你喜欢
随机推荐
【云驻共创】企业数字化转型,华为云咨询与你同行
Xiao Hei stands up again and looks at leetcode:653. Sum of two IV - enter BST
Cloudcompare & PCL matching point sampling consistency suppression
[learning notes] border and period
Netease written test No. 2 -- typical application of European distance
Arthas tutorial
Guangzhou metro line 14 xinshixu station is under construction, and residents in Baiyun District are about to start a double line transfer mode!
13、哈希表——两个链表第一个公共节点
3.用数组逆序打印链表
OSPF expansion configuration, routing principles, anti ring and re release
8、数组中出现次数超过一半的数字
Illustrate three mainstream enterprise architecture models (recommended collection!)
[esp32][esp idf] ap+sta realizes wireless bridging and transferring WiFi signals
Talk about the problem of preventing others from debugging websites through console based on JS implementation
Redis design specification
数据库mysql基础
ADVANCE.AI出海指南助力企业出海印尼,掌握东南亚市场半边天
QT | some summaries of signals and slots
Kubernetes
14、双指针——盛最多水的容器









