反馈人:袁慧斌
数据库:zhcxkj_center_bi
查询时间:11.2706
扫描行数:2554.8
发送行数:999.702
指纹SQL: ( select source_id , child_asin , max ( report_date ) as reportDate , sum ( case when report_date <= '?' then page_views else ? end ) as sessions , sum ( case when report_date > '?' then page_views else ? end ) as pageViews , sum ( case when report_date <= '?' then browser_page_views_percentage else ? end ) as browserSessionPercentage , sum ( case when report_date > '?' then browser_page_views_percentage else ? end ) as browserPageViewsPercentage FROM ? where source_id = ? and child_asin = '?' and report_date >= '?' and report_date <= '?' GROUP by source_id , child_asin ) union all ( select source_id , child_asin , max ( report_date ) as reportDate , sum ( case when report_date <= '?' then page_views else ? end ) as sessions , sum ( case when report_date > '?' then page_views else ? end ) as pageViews , sum ( case when report_date <= '?' then browser_page_views_percentage else ? end ) as browserSessionPercentage , sum ( case when report_date > '?' then browser_page_views_percentage else ? end ) as browserPageViewsPercentage FROM ? where source_id = ? and child_asin = '?' and report_date >= '?' and report_date <= '?' GROUP by source_id , child_asin ) union all ( select source_id , child_asin , max ( report_date ) as reportDate , sum ( case when report_date <= '?' then page_views else ? end ) as sessions , sum ( case when report_date > '?' then page_views else ? end ) as pageViews , sum ( case when report_date <= '?' then browser_page_views_percentage else ? end ) as browserSessionPercentage , sum ( case when report_date > '?' then browser_page_views_percentage else ? end ) as browserPageViewsPercentage FROM ? where source_id = ? and child_asin = '?' and report_date >= '?' and report_date <= '?' GROUP by source_id , child_asin ) union all ( select source_id , child_asin , max ( report_date ) as reportDate , sum ( case when report_date <= '?' then page_views else ? end
真实SQL:( select source_id,child_asin,max(report_date) as reportDate, sum(case when report_date <= '2025-06-06 00:00:00' then page_views else 0 end ) as sessions , sum(case when report_date > '2025-06-06 00:00:00' then page_views else 0 end ) as pageViews, sum(case when report_date <= '2025-06-06 00:00:00' then browser_page_views_percentage else 0 end ) as browserSessionPercentage, sum(case when report_date > '2025-06-06 00:00:00' then browser_page_views_percentage else 0 end ) as browserPageViewsPercentage from t_amz_sales_and_traffic_report_asin where source_id = 13332 and child_asin = 'B08N6FTJ4J' and report_date >= '2025-05-23 00:00:00' and report_date <= '2025-06-21 00:00:00' GROUP by source_id,child_asin ) union all ( select source_id,child_asin,max(report_date) as reportDate, sum(case when report_date <= '2025-04-11 00:00:00' then page_views else 0 end ) as sessions , sum(case when report_date > '2025-04-11 00:00:00' then page_views else 0 end ) as pageViews, sum(case when report_date <= '2025-04-11 00:00:00' then browser_page_views_percentage else 0 end ) as browserSessionPercentage, sum(case when report_date > '2025-04-11 00:00:00' then browser_page_views_percentage else 0 end ) as browserPageViewsPercentage from t_amz_sales_and_traffic_report_asin where source_id = 13332 and child_asin = 'B08TWSBWV1' and report_date >= '2025-03-28 00:00:00' and report_date <= '2025-04-26 00:00:00' GROUP by source_id,child_asin ) union all ( select source_id,child_asin,max(report_date) as reportDate, sum(case when report_date <= '2025-07-04 00:00:00' then page_views else 0 end ) as sessions , sum(case when report_date > '2025-07-04 00:00:00' then page_views else 0 end ) as pageViews, sum(case when report_date <= '2025-07-04 00:00:00' then browser_page_views_percentage else 0 end ) as browserSessionPercentage, sum(case when report_date > '2025-07-04 00:00:00' then browser_page_views_percentage else 0 end ) as browserPageViewsPercentage from t_amz_sales_and_traffic_report_asin where source_id = 13332 and child_asin = 'B09CSY15WW' and report_date >= '2025-06-20 00:00:00' and report_date <= '2025-07-19 00:00:00' GROUP by source_id,child_asin ) union all ( select source_id,child_asin,max(report_date) as reportDate, sum(case when report_date <= '2025-06-04 00:00:00' then page_views else 0 end ) as sessions , sum(case when report_date > '2025-06-04 00:00:00' then page_views else 0 end ) as pageViews, sum(case when report_date <= '2025-06-04 00:00:00' then browser_page_views_percentage else 0 end ) as browserSessionPercentage, sum(case when report_date > '2025-06-04 00:00:00' then browser_page_views_percentage else 0 end ) as browserPageViewsPercentage from t_amz_sales_and_traffic_report_asin where source_id = 13332 and child_asin = 'B09CTST8C5' and report_date >= '2025-05-21 00:00:00' and report_date <= '2025-06-19 00:00:00' GROUP by source_id,child_asin ) union all ( select source_id,child_asin,max(report_date) as reportDate, sum(case when report_date <= '2025-05-29 00:00:00' then page_views else 0 end ) as sessions , sum(case when report_date > '2025-05-29 00:00:00' then page_views else 0 end ) as pageViews, sum(case when report_date <= '2025-05-29 00:00:00' then browser_page_views_percentage else 0 end ) as browserSessionPercentage, sum(case when report_date > '2025-05-29 00:00:00' then browser_page_views_percentage else 0 end ) as browserPageViewsPercentage from t_amz_sales_and_traffic_report_asin where source_id = 13332 and child_asin = 'B09CTY3Z96' and report_date >= '2025-05-15 00:00:00' and report_date <= '2025-06-13 00:00:00' GROUP by source_id,child_asin ) union all ( select source_id,child_asin,max(report_date) as reportDate, sum(case when report_date <= '2025-07-19 00:00:00' then page_views else 0 end ) as sessions , sum(case when report_date > '2025-07-19 00:00:00' then page_views else 0 end ) as pageViews, sum(case when report_date <= '2025-07-19 00:00:00' then browser_page_views_percentage else 0 end ) as browserSessionPercentage, sum(case when report_date > '2025-07-19 00:00:00' then browser_page_views_percentage else 0 end ) as browserPageViewsPercentage from t_amz_sales_and_traffic_report_asin where source_id = 13332 and child_asin = 'B09CYTY8TJ' and report_date >= '2025-07-15 00:00:00' and report_date <= '2025-07-24 00:00:00' GROUP by source_id,child_asin ) union all ( select source_id,child_asin,max(report_date) as reportDate, sum(case when report_date <= '2024-07-15 00:00:00' then page_views else 0 end ) as sessions , sum(case when report_date > '2024-07-15 00:00:00' then page_views else 0 end ) as pageViews, sum(case when report_date <= '2024-07-15 00:00:00' then browser_page_views_percentage else 0 end ) as browserSessionPercentage, sum(case when report_date > '2024-07-15 00:00:00' then browser_page_views_percentage else 0 end ) as browserPageViewsPercentage from t_amz_sales_and_traffic_report_asin where source_id = 13332 and child_asin = 'B09D3HFM43' and report_date >= '2024-07-01 00:00:00' and report_date <= '2024-07-30 00:00:00' GROUP by source_id,child_asin ) union all ( select source_id,child_asin,max(report_date) as reportDate, sum(case when report_date <= '2024-07-19 00:00:00' then page_views else 0 end ) as sessions , sum(case when report_date > '2024-07-19 00:00:00' then page_views else 0 end ) as pageViews, sum(case when report_date <= '2024-07-19 00:00:00' then browser_page_views_percentage else 0 end ) as browserSessionPercentage, sum(case when report_date > '2024-07-19 00:00:00' then browser_page_views_percentage else 0 end ) as browserPageViewsPercentage from t_amz_sales_and_traffic_report_asin where source_id = 13332 and child_asin = 'B09D3RS92T' and report_date >= '2024-07-05 00:00:00' and report_date <= '2024-08-03 00:00:00' GROUP by source_id,child_asin ) union all ( select source_id,child_asin,max(report_date) as reportDate, sum(case when report_date <= '2025-06-28 00:00:00' then page_views else 0 end ) as sessions , sum(case when report_date > '2025-06-28 00:00:00' then page_views else 0 end ) as pageViews, sum(case when report_date <= '2025-06-28 00:00:00' then browser_page_views_percentage else 0 end ) as browserSessionPercentage, sum(case when report_date > '2025-06-28 00:00:00' then browser_page_views_percentage else 0 end ) as browserPageViewsPercentage from t_amz_sales_and_traffic_report_asin where source_id = 13332 and child_asin = 'B09D3W1JLW' and report_date >= '2025-06-14 00:00:00' and report_date <= '2025-07-13 00:00:00' GROUP by source_id,child_asin ) union all ( select source_id,child_asin,max(report_date) as reportDate, sum(case when report_date <= '2025-02-19 00:00:00' then page_views else 0 end ) as sessions , sum(case when report_date > '2025-02-19 00:00:00' then page_views else 0 end ) as pageViews, sum(case when report_date <= '2025-02-19 00:00:00' then browser_page_views_percentage else 0 end ) as browserSessionPercentage, sum(case when report_date > '2025-02-19 00:00:00' then browser_page_views_percentage else 0 end ) as browserPageViewsPercentage from t_amz_sales_and_traffic_report_asin where source_id = 13332 and child_asin = 'B09D9326C9' and report_date >= '2025-02-05 00:00:00' and report_date <= '2025-03-06 00:00:00' GROUP by source_id,child_asin ) union all ( select source_id,child_asin,max(report_date) as reportDate, sum(case when report_date <= '2024-10-22 00:00:00' then page_views else 0 end ) as sessions , sum(case when report_date > '2024-10-22 00:00:00' then page_views else 0 end ) as pageViews, sum(case when report_date <= '2024-10-22 00:00:00' then browser_page_views_percentage else 0 end ) as browserSessionPercentage, sum(case when report_date > '2024-10-22 00:00:00' then browser_page_views_percentage else 0 end ) as browserPageViewsPercentage from t_amz_sales_and_traffic_report_asin where source_id = 13332 and child_asin = 'B09DKDD8RS' and report_date >= '2024-10-08 00:00:00' and report_date <= '2024-11-06 00:00:00' GROUP by source_id,child_asin ) union all ( select source_id,child_asin,max(report_date) as reportDate, sum(case when report_date <= '2024-12-05 00:00:00' then page_views else 0 end ) as sessions , sum(case when report_date > '2024-12-05 00:00:00' then page_views else 0 end ) as pageViews, sum(case when report_date <= '2024-12-05 00:00:00' then browser_page_views_percentage else 0 end ) as browserSessionPercentage, sum(case whe...;
##袁慧斌,人工修改过##
AISQL修改建议:SQL 过于复杂 请拆分成独立模块
explain表:
额外建议:
索引建议:
重现步骤


