[性能问题描述]
SELECT id,uniqueKey,orderSourceSku,orderSourceId,asin,sku,siteCode,`status`,aiTitle,aiTitleId FROM t_ai_title_4 WHERE orderSourceId=31484 and status=10 and Id>0 order by id asc limit 100

[分析过程]
数据库配置低 并发大 CPU 跑满
[期望结果]
提升效率 降低CPU 的使用率
[性能问题描述]
SELECT id,uniqueKey,orderSourceSku,orderSourceId,asin,sku,siteCode,`status`,aiTitle,aiTitleId FROM t_ai_title_4 WHERE orderSourceId=31484 and status=10 and Id>0 order by id asc limit 100

[分析过程]
数据库配置低 并发大 CPU 跑满
[期望结果]
提升效率 降低CPU 的使用率
优化方案工单都写清楚了,工单: 202605060023
HWY-ZH-GZ-RDS-AutoPublish实例 zhcxkj_rebuildtitle 库, 应用znyf-rebuildtitle-amazon 慢sql: SELECT id,uniqueKey,orderSourceSku,orderSourceId,asin,sku,siteCode,status,aiTitle,aiTitleId FROM t_ai_title_4 WHERE orderSourceId=28224 and status=10 and Id>0 order by id asc limit 100;
优化建议:
1、并发过高,数据库上百条以上并发查询,导致卡顿cpu打满
2、 order by id 文件排序(Using filesort) 严重影响性能,id字段是主键,默认返回就是按id排序,无需再排序,去掉后可提升5-10倍性能
SQL稍微调整一下就有5倍以上性能提升
| 由谁创建 | 袁慧斌 于 2026-04-28 15:38:46 |
|---|---|
| 影响环境 |
生产环境-业务反馈 |
| 由谁解决 | 戴宝山 于 2026-05-18 09:25:46 |
| 解决版本 | 主干 |
| 解决方案 | 程序BUG |
| 由谁关闭 | 袁慧斌 于 2026-05-21 09:25:37 |
| 最后修改 | 袁慧斌 于 2026-05-21 09:25:37 |
| 相关Bug |
|---|
项目服务:AI重生标题,提交到通用上架队列
代码排查:很早就在用的方法,sql没有可优化的空间
解决方案:
1、升级数据库实例配置
2、降低线程并发,有提交数据减少风险