【 TiDB 使用环境】生产环境
【 TiDB 版本】
【复现路径】执行较大的sql
【遇到的问题:问题现象及影响】 机器内存使用90%
【资源配置】机器内存128G
【附件:截图/日志/监控】
SQL语句:
“SELECT 自定义 SQL 查询
.activation_user_num
AS activation_user_num
,\n 自定义 SQL 查询
.amount
AS amount
,\n 自定义 SQL 查询
.campaign_id
AS campaign_id
,\n 自定义 SQL 查询
.groupid
AS groupid
,\n 自定义 SQL 查询
.guiyin_source
AS guiyin_source
,\n 自定义 SQL 查询
.hour_time
AS hour_time
,\n 自定义 SQL 查询
.is_dxz
AS is_dxz
,\n 自定义 SQL 查询
.keyword_id
AS keyword_id
,\n 自定义 SQL 查询
.ocpc_user_num
AS ocpc_user_num
,\n 自定义 SQL 查询
.order_num
AS order_num
,\n 自定义 SQL 查询
.rong_adid
AS rong_adid
,\n 自定义 SQL 查询
.source
AS source
,\n 自定义 SQL 查询
.subTaskId
AS subTaskId
,\n 自定义 SQL 查询
.tjy_amount
AS tjy_amount
,\n 自定义 SQL 查询
.tjy_order_num
AS tjy_order_num
\nFROM (\n select \r\n hour_time as hour_time\r\n ,lower(source) as source\r\n ,lower(guiyin_source) as guiyin_source\r\n ,trim(campaign_id) as campaign_id\r\n ,trim(rong_adid) as rong_adid\r\n ,trim(keyword_id )as keyword_id\r\n ,trim(groupid) as groupid\r\n ,trim(subTaskId) as subTaskId\r\n ,is_dxz as is_dxz\r\n ,sum(activation_user_num) as activation_user_num\r\n ,sum(order_num) as order_num\r\n ,sum(amount) as amount\r\n ,sum(tjy_order_num) as tjy_order_num\r\n ,sum(tjy_amount) as tjy_amount\r\n ,sum(ocpc_user_num) as ocpc_user_num\r\n from \r\n (select \r\n t1.hour_time as hour_time\r\n ,t1.source as source\r\n ,t1.source as guiyin_source\r\n ,t1.campaign_id as campaign_id\r\n ,case when t1.rong_adid is null then 0 else t1.rong_adid end as rong_adid\r\n ,t1.keyword_id as keyword_id\r\n ,case when t1.groupid is null then 0 else t1.groupid end as groupid\r\n ,t1.is_dxz as is_dxz\r\n ,case when t1.subTaskId is null then 0 else t1.subTaskId end as subTaskId\r\n ,count(distinct t1.rid) as activation_user_num\r\n ,0 as order_num\r\n ,0 as amount\r\n ,0 as tjy_order_num\r\n ,0 as tjy_amount\r\n ,0 as ocpc_user_num\r\n from \r\n app_active_campaign_hour t1\r\n where date(t1.hour_time) >= ‘2023-11-01’\r\n group by t1.hour_time\r\n ,t1.source \r\n ,t1.source \r\n ,t1.campaign_id \r\n ,case when t1.rong_adid is null then 0 else t1.rong_adid end \r\n ,t1.keyw”(len:7768);
执行计划:
slow.sql (108.1 KB)