重现步骤

反馈人:袁慧斌

问题1:

数据库:zhcxkj_center_adv_amazon
查询时间:10.1304
扫描行数:914.98
发送行数:1
指纹SQL: select count ( DISTINCT source_id , ad_id , ad_group_id , campaign_id , site_hour ) from ( select p . source_id , p . ad_id , p . ad_group_id , p . campaign_id , cv . site_hour , p . creative_asins FROM ? p left join t_amazon_sb_advertisement cv on p . ad_id = cv . ad_id and p . ad_group_id = cv . ad_group_id and p . campaign_id = cv . campaign_id where p . source_id = ? and cv . own_hour >= ? and cv . own_hour <= ? and cv . site_date >= ? UNION all select p . source_id , p . ad_id , p . ad_group_id , p . campaign_id , cv . site_hour , p . creative_asins FROM ? p left join t_amazon_sb_ad_traffic cv on p . ad_id = cv . ad_id and p . ad_group_id = cv . ad_group_id and p . campaign_id = cv . campaign_id where p . source_id = ? and cv . own_hour >= ? and cv . own_hour <= ? and cv . site_date >= ? ) t where LENGTH ( t . creative_asins ) > ? ;
真实SQL:select count(DISTINCT source_id, ad_id, ad_group_id, campaign_id, site_hour) from( select p.source_id, p.ad_id, p.ad_group_id, p.campaign_id, cv.site_hour, p.creative_asins from t_sb_ad_product p left join t_amazon_sb_advertisement cv on p.ad_id = cv.ad_id and p.ad_group_id = cv.ad_group_id and p.campaign_id = cv.campaign_id where p.source_id = 16549 and cv.own_hour >= 2025080405 and cv.own_hour <= 2025080408 and cv.site_date >= 2025-06-10 UNION all select p.source_id, p.ad_id, p.ad_group_id, p.campaign_id, cv.site_hour, p.creative_asins from t_sb_ad_product p left join t_amazon_sb_ad_traffic cv on p.ad_id = cv.ad_id and p.ad_group_id = cv.ad_group_id and p.campaign_id = cv.campaign_id where p.source_id = 16549 and cv.own_hour >= 2025080405 and cv.own_hour <= 2025080408 and cv.site_date >= 2025-06-10 ) t where LENGTH(t.creative_asins) >2;
无人工修改
AISQL修改建议:SELECT COUNT(*) FROM (
SELECT DISTINCT p.source_id, p.ad_id, p.ad_group_id, p.campaign_id, cv.site_hour
FROM t_sb_ad_product p
INNER JOIN t_amazon_sb_advertisement cv ON p.ad_id = cv.ad_id
AND p.ad_group_id = cv.ad_group_id
AND p.campaign_id = cv.campaign_id
WHERE p.source_id = 16549
AND cv.own_hour BETWEEN 2025080405 AND 2025080408
AND cv.site_date >= 2025-06-10
AND LENGTH(p.creative_asins) > 2

UNION

SELECT DISTINCT p.source_id, p.ad_id, p.ad_group_id, p.campaign_id, cv.site_hour
FROM t_sb_ad_product p
INNER JOIN t_amazon_sb_ad_traffic cv ON p.ad_id = cv.ad_id
AND p.ad_group_id = cv.ad_group_id
AND p.campaign_id = cv.campaign_id
WHERE p.source_id = 16549
AND cv.own_hour BETWEEN 2025080405 AND 2025080408
AND cv.site_date >= 2025-06-10
AND LENGTH(p.creative_asins) > 2
) t;
explain表:










id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <derived2> None ALL None None None None 434 100 Using where
2 DERIVED cv None range idx_adid,idx_own_hour idx_own_hour 5 None 290 33.33 Using index condition; Using where
2 DERIVED p None eq_ref uidx_ad_id uidx_ad_id 782 const,zhcxkj_center_adv_amazon.cv.campaign_id,zhcxkj_center_adv_amazon.cv.ad_group_id,zhcxkj_center_adv_amazon.cv.ad_id 1 100 Using index condition
3 UNION cv None range idx_own_hour,idx_adid idx_own_hour 5 None 6218 33.33 Using index condition; Using where
3 UNION p None ref uidx_ad_id uidx_ad_id 8 const 163 0.1 Using index condition

额外建议:索引列使用了函数作计算:【LENGTH(t.creative_asins) >】,会导致索引失效。如果你是MySQL 8.0可以考虑创建函数索引;如果你是MySQL 5.7,你要更改你的SQL逻辑了。

索引建议:
建议添加索引:ALTER TABLE t_amazon_sb_ad_traffic ADD INDEX idx_own_hour_site_date(own_hour,site_date);


【t_amazon_sb_ad_traffic】表 【own_hour,site_date】字段,索引分析:
+------------------------+--------------+---------------+---------------+
| TABLE_NAME | INDEX_NAME | COLUMN_NAME | CARDINALITY |
+========================+==============+===============+===============+
| t_amazon_sb_ad_traffic | idx_adid | own_hour | 121811 |
+------------------------+--------------+---------------+---------------+
| t_amazon_sb_ad_traffic | idx_own_hour | own_hour | 2368 |
+------------------------+--------------+---------------+---------------+

建议添加索引:ALTER TABLE t_sb_ad_product ADD INDEX idx_source_id_creative_asins(source_id,creative_asins);


【t_sb_ad_product】表 【source_id,creative_asins】字段,索引分析:
+-----------------+--------------+---------------+---------------+
| TABLE_NAME | INDEX_NAME | COLUMN_NAME | CARDINALITY |
+=================+==============+===============+===============+
| t_sb_ad_product | uidx_ad_id | source_id | 45 |
+-----------------+--------------+---------------+---------------+

建议添加索引:ALTER TABLE t_amazon_sb_ad_traffic ADD INDEX idx_own_hour_site_date(own_hour,site_date);


【t_amazon_sb_ad_traffic】表 【own_hour,site_date】字段,索引分析:
+------------------------+--------------+---------------+---------------+
| TABLE_NAME | INDEX_NAME | COLUMN_NAME | CARDINALITY |
+========================+==============+===============+===============+
| t_amazon_sb_ad_traffic | idx_adid | own_hour | 121811 |
+------------------------+--------------+---------------+---------------+
| t_amazon_sb_ad_traffic | idx_own_hour | own_hour | 2368 |
+------------------------+--------------+---------------+---------------+

建议添加索引:ALTER TABLE t_sb_ad_product ADD INDEX idx_source_id_creative_asins(source_id,creative_asins);


【t_sb_ad_product】表 【source_id,creative_asins】字段,索引分析:
+-----------------+--------------+---------------+---------------+
| TABLE_NAME | INDEX_NAME | COLUMN_NAME | CARDINALITY |
+=================+==============+===============+===============+
| t_sb_ad_product | uidx_ad_id | source_id | 45 |
+-----------------+--------------+---------------+---------------+

问题2:

数据库:zhcxkj_center_bi
查询时间:14.7593
扫描行数:292326
发送行数:247.826
指纹SQL: SELECT id , report_date , source_id , customer_id , parent_asin , child_asin , units_ordered , units_ordered_b2b , ordered_product_sales_amount , ordered_product_sales_currency_code , ordered_product_sales_b2b_amount , ordered_product_sales_b2b_currency_code , total_order_items , total_order_items_b2b , browser_sessions , browser_sessions_b2b , mobile_app_sessions , mobile_app_sessions_b2b , sessions , sessions_b2b , browser_session_percentage , browser_session_percentage_b2b , mobile_app_session_percentage , mobile_app_session_percentage_b2b , session_percentage , session_percentage_b2b , browser_page_views , browser_page_views_b2b , mobile_app_page_views , mobile_app_page_views_b2b , page_views , page_views_b2b , browser_page_views_percentage , browser_page_views_percentage_b2b , mobile_app_page_views_percentage , mobile_app_page_views_percentage_b2b , page_views_percentage , page_views_percentage_b2b , buy_box_percentage , buy_box_percentage_b2b , unit_session_percentage , unit_session_percentage_b2b , update_time FROM ? WHERE id in ( SELECT id FROM ? WHERE source_id IN ( ? ) AND update_time >= ? AND update_time <= ? ) ORDER BY id asc LIMIT ? ;
真实SQL:SELECT id, report_date, source_id, customer_id, parent_asin, child_asin, units_ordered, units_ordered_b2b, ordered_product_sales_amount, ordered_product_sales_currency_code, ordered_product_sales_b2b_amount, ordered_product_sales_b2b_currency_code, total_order_items, total_order_items_b2b, browser_sessions, browser_sessions_b2b, mobile_app_sessions, mobile_app_sessions_b2b, sessions, sessions_b2b, browser_session_percentage, browser_session_percentage_b2b, mobile_app_session_percentage, mobile_app_session_percentage_b2b, session_percentage, session_percentage_b2b, browser_page_views, browser_page_views_b2b, mobile_app_page_views, mobile_app_page_views_b2b, page_views, page_views_b2b, browser_page_views_percentage, browser_page_views_percentage_b2b, mobile_app_page_views_percentage, mobile_app_page_views_percentage_b2b, page_views_percentage, page_views_percentage_b2b, buy_box_percentage, buy_box_percentage_b2b, unit_session_percentage, unit_session_percentage_b2b, update_time FROM t_amz_sales_and_traffic_report_asin WHERE id in ( SELECT id FROM t_amz_sales_and_traffic_report_asin WHERE source_id IN ( 6153 ) AND update_time >= 2025-08-05 00:00:00 AND update_time <= 2025-08-05 23:59:59 ) ORDER BY id asc LIMIT 300;
无人工修改
AISQL修改建议:SELECT t1.id, t1.report_date, t1.source_id, t1.customer_id, t1.parent_asin, t1.child_asin, t1.units_ordered, t1.units_ordered_b2b, t1.ordered_product_sales_amount, t1.ordered_product_sales_currency_code, t1.ordered_product_sales_b2b_amount, t1.ordered_product_sales_b2b_currency_code, t1.total_order_items, t1.total_order_items_b2b, t1.browser_sessions, t1.browser_sessions_b2b, t1.mobile_app_sessions, t1.mobile_app_sessions_b2b, t1.sessions, t1.sessions_b2b, t1.browser_session_percentage, t1.browser_session_percentage_b2b, t1.mobile_app_session_percentage, t1.mobile_app_session_percentage_b2b, t1.session_percentage, t1.session_percentage_b2b, t1.browser_page_views, t1.browser_page_views_b2b, t1.mobile_app_page_views, t1.mobile_app_page_views_b2b, t1.page_views, t1.page_views_b2b, t1.browser_page_views_percentage, t1.browser_page_views_percentage_b2b, t1.mobile_app_page_views_percentage, t1.mobile_app_page_views_percentage_b2b, t1.page_views_percentage, t1.page_views_percentage_b2b, t1.buy_box_percentage, t1.buy_box_percentage_b2b, t1.unit_session_percentage, t1.unit_session_percentage_b2b, t1.update_time FROM t_amz_sales_and_traffic_report_asin t1 JOIN (SELECT id FROM t_amz_sales_and_traffic_report_asin WHERE source_id = 6153 AND update_time BETWEEN 2025-08-05 00:00:00 AND 2025-08-05 23:59:59 ORDER BY id ASC LIMIT 300) t2 ON t1.id = t2.id;
explain表:

id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t_amz_sales_and_traffic_report_asin None range PRIMARY,uk_source_id_msku,idx_update_time_source_id,idx_sourceid_updatetime idx_sourceid_updatetime 10 None 1350 100 Using where; Using index; Using temporary; Using filesort
1 SIMPLE t_amz_sales_and_traffic_report_asin None eq_ref PRIMARY PRIMARY 8 zhcxkj_center_bi.t_amz_sales_and_traffic_report_asin.id 1 100 None

额外建议:
索引建议:
建议添加索引:ALTER TABLE t_amz_sales_and_traffic_report_asin ADD INDEX idx_id_source_id_update_time(id,source_id,update_time);
【t_amz_sales_and_traffic_report_asin】表 【id,source_id,update_time】字段,索引分析:
+--------------------------------+--------------------------------+---------------+---------------+
| TABLE_NAME | INDEX_NAME | COLUMN_NAME | CARDINALITY |
+================================+================================+===============+===============+
| t_amz_sales_and_traffic_report | idx_report_date_child_asin_sou | source_id | 262883712 |
| _asin | rce_id | | |
+--------------------------------+--------------------------------+---------------+---------------+
| t_amz_sales_and_traffic_report | idx_sourceid_updatetime | source_id | 447185 |
| _asin | | | |
+--------------------------------+--------------------------------+---------------+---------------+
| t_amz_sales_and_traffic_report | idx_sourceid_updatetime | update_time | 1255422 |
| _asin | | | |
+--------------------------------+--------------------------------+---------------+---------------+
| t_amz_sales_and_traffic_report | idx_update_time_source_id | source_id | 1188044 |
| _asin | | | |
+--------------------------------+--------------------------------+---------------+---------------+
| t_amz_sales_and_traffic_report | idx_update_time_source_id | update_time | 276078 |
| _asin | | | |
+--------------------------------+--------------------------------+---------------+---------------+
| t_amz_sales_and_traffic_report | PRIMARY | id | 260823952 |
| _asin | | | |
+--------------------------------+--------------------------------+---------------+---------------+
| t_amz_sales_and_traffic_report | uk_report_date_source_id_msku | source_id | 3053827 |
| _asin | | | |
+--------------------------------+--------------------------------+---------------+---------------+
| t_amz_sales_and_traffic_report | uk_source_id_msku | source_id | 607146 |
| _asin | | | |
+--------------------------------+--------------------------------+---------------+---------------+
历史记录  
  1. 2025-08-06 12:41:37, 由 陈莉珍 创建。
  2. 2025-08-06 12:42:53, 由 陈莉珍 编辑。
    修改了 所属项目,旧值为 "51",新值为 "52"。
    修改了 所属模块,旧值为 "0",新值为 "1832"。
    修改了 业务部门,旧值为 "0",新值为 "2"。
    修改了 解决时效,旧值为 "0",新值为 "-1"。
    修改了 重现步骤,区别为:
    001- 反馈人:袁慧斌
    001+ 反馈人:袁慧斌
    002- 数据库:zhcxkj_center_adv_amazon
    002+ 问题1:
    003- 查询时间:10.1304
    003+ 数据库:zhcxkj_center_adv_amazon
    004- 扫描行数:914.98
    004+ 查询时间:10.1304 扫描行数:914.98 发送行数:1 指纹SQL: select count ( DISTINCT source_id , ad_id , ad_group_id , campaign_id , site_hour ) from ( select p . source_id , p . ad_id , p . ad_group_id , p . campaign_id , cv . site_hour , p . creative_asins FROM ? p left join t_amazon_sb_advertisement cv on p . ad_id = cv . ad_id and p . ad_group_id = cv . ad_group_id and p . campaign_id = cv . campaign_id where p . source_id = ? and cv . own_hour &gt;= ? and cv . own_hour &lt;= ? and cv . site_date &gt;= ? UNION all select p . source_id , p . ad_id , p . ad_group_id , p . campaign_id , cv . site_hour , p . creative_asins FROM ? p left join t_amazon_sb_ad_traffic cv on p . ad_id = cv . ad_id and p . ad_group_id = cv . ad_group_id and p . campaign_id = cv . campaign_id where p . source_id = ? and cv . own_hour &gt;= ? and cv . own_hour &lt;= ? and cv . site_date &gt;= ? ) t where LENGTH ( t . creative_asins ) &gt; ? ; 真实SQL:select count(DISTINCT source_id, ad_id, ad_group_id, campaign_id, site_hour) from( select p.source_id, p.ad_id, p.ad_group_id, p.campaign_id, cv.site_hour, p.creative_asins from t_sb_ad_product p left join t_amazon_sb_advertisement cv on p.ad_id = cv.ad_id and p.ad_group_id = cv.ad_group_id and p.campaign_id = cv.campaign_id where p.source_id = 16549 and cv.own_hour &gt;= 2025080405 and cv.own_hour &lt;= 2025080408 and cv.site_date &gt;= 2025-06-10 UNION all select p.source_id, p.ad_id, p.ad_group_id, p.campaign_id, cv.site_hour, p.creative_asins from t_sb_ad_product p left join t_amazon_sb_ad_traffic cv on p.ad_id = cv.ad_id and p.ad_group_id = cv.ad_group_id and p.campaign_id = cv.campaign_id where p.source_id = 16549 and cv.own_hour &gt;= 2025080405 and cv.own_hour &lt;= 2025080408 and cv.site_date &gt;= 2025-06-10 ) t where LENGTH(t.creative_asins) &gt;2; 无人工修改 AISQL修改建议:SELECT COUNT(*) FROM ( SELECT DISTINCT p.source_id, p.ad_id, p.ad_group_id, p.campaign_id, cv.site_hour FROM t_sb_ad_product p INNER JOIN t_amazon_sb_advertisement cv ON p.ad_id = cv.ad_id AND p.ad_group_id = cv.ad_group_id AND p.campaign_id = cv.campaign_id WHERE p.source_id = 16549 AND cv.own_hour BETWEEN 2025080405 AND 2025080408 AND cv.site_date &gt;= 2025-06-10 AND LENGTH(p.creative_asins) &gt; 2 UNION SELECT DISTINCT p.source_id, p.ad_id, p.ad_group_id, p.campaign_id, cv.site_hour FROM t_sb_ad_product p INNER JOIN t_amazon_sb_ad_traffic cv ON p.ad_id = cv.ad_id AND p.ad_group_id = cv.ad_group_id AND p.campaign_id = cv.campaign_id WHERE p.source_id = 16549 AND cv.own_hour BETWEEN 2025080405 AND 2025080408 AND cv.site_date &gt;= 2025-06-10 AND LENGTH(p.creative_asins) &gt; 2 ) t; explain表:id
    005- 发送行数:1
    005+ select_type
    006- 指纹SQL: select count ( DISTINCT source_id , ad_id , ad_group_id , campaign_id , site_hour ) from ( select p . source_id , p . ad_id , p . ad_group_id , p . campaign_id , cv . site_hour , p . creative_asins FROM ? p left join t_amazon_sb_advertisement cv on p . ad_id = cv . ad_id and p . ad_group_id = cv . ad_group_id and p . campaign_id = cv . campaign_id where p . source_id = ? and cv . own_hour &gt;= ? and cv . own_hour &lt;= ? and cv . site_date &gt;= ? UNION all select p . source_id , p . ad_id , p . ad_group_id , p . campaign_id , cv . site_hour , p . creative_asins FROM ? p left join t_amazon_sb_ad_traffic cv on p . ad_id = cv . ad_id and p . ad_group_id = cv . ad_group_id and p . campaign_id = cv . campaign_id where p . source_id = ? and cv . own_hour &gt;= ? and cv . own_hour &lt;= ? and cv . site_date &gt;= ? ) t where LENGTH ( t . creative_asins ) &gt; ? ;
    006+ table
    007- 真实SQL:select count(DISTINCT source_id, ad_id, ad_group_id, campaign_id, site_hour) from( select p.source_id, p.ad_id, p.ad_group_id, p.campaign_id, cv.site_hour, p.creative_asins from t_sb_ad_product p left join t_amazon_sb_advertisement cv on p.ad_id = cv.ad_id and p.ad_group_id = cv.ad_group_id and p.campaign_id = cv.campaign_id where p.source_id = 16549 and cv.own_hour &gt;= 2025080405 and cv.own_hour &lt;= 2025080408 and cv.site_date &gt;= 2025-06-10 UNION all select p.source_id, p.ad_id, p.ad_group_id, p.campaign_id, cv.site_hour, p.creative_asins from t_sb_ad_product p left join t_amazon_sb_ad_traffic cv on p.ad_id = cv.ad_id and p.ad_group_id = cv.ad_group_id and p.campaign_id = cv.campaign_id where p.source_id = 16549 and cv.own_hour &gt;= 2025080405 and cv.own_hour &lt;= 2025080408 and cv.site_date &gt;= 2025-06-10 ) t where LENGTH(t.creative_asins) &gt;2;
    007+ partitions
    008- 无人工修改
    008+ type
    009- AISQL修改建议:SELECT COUNT(*) FROM (
    009+ possible_keys
    010- SELECT DISTINCT p.source_id, p.ad_id, p.ad_group_id, p.campaign_id, cv.site_hour
    010+ key
    011- FROM t_sb_ad_product p
    011+ key_len
    012- INNER JOIN t_amazon_sb_advertisement cv ON p.ad_id = cv.ad_id
    012+ ref
    013- AND p.ad_group_id = cv.ad_group_id
    013+ rows
    014- AND p.campaign_id = cv.campaign_id
    014+ filtered
    015- WHERE p.source_id = 16549
    015+ Extra
    016- AND cv.own_hour BETWEEN 2025080405 AND 2025080408
    016+ 1
    017- AND cv.site_date &gt;= 2025-06-10
    017+ PRIMARY
    018- AND LENGTH(p.creative_asins) &gt; 2
    018+ &lt;derived2&gt;
    019-
    019+ None
    020- UNION
    020+ ALL
    021-
    021+ None
    022- SELECT DISTINCT p.source_id, p.ad_id, p.ad_group_id, p.campaign_id, cv.site_hour
    022+ None
    023- FROM t_sb_ad_product p
    023+ None
    024- INNER JOIN t_amazon_sb_ad_traffic cv ON p.ad_id = cv.ad_id
    024+ None
    025- AND p.ad_group_id = cv.ad_group_id
    025+ 434
    026- AND p.campaign_id = cv.campaign_id
    026+ 100
    027- WHERE p.source_id = 16549
    027+ Using where
    028- AND cv.own_hour BETWEEN 2025080405 AND 2025080408
    028+ 2
    029- AND cv.site_date &gt;= 2025-06-10
    029+ DERIVED
    030- AND LENGTH(p.creative_asins) &gt; 2
    030+ cv
    031- ) t;
    031+ None
    032- explain表:
    032+ range
    033-
    033+ idx_adid,idx_own_hour
    034-
    034+ idx_own_hour
    035-
    035+ 5
    036-
    036+ None
    037-
    037+ 290
    038-
    038+ 33.33
    039-
    039+ Using index condition; Using where
    040-
    040+ 2
    041-
    041+ DERIVED
    042-
    042+ p
    043-
    043+ None
    044-
    044+ eq_ref
    045-
    045+ uidx_ad_id
    046-
    046+ uidx_ad_id
    047- id
    047+ 782
    048-
    048+ const,zhcxkj_center_adv_amazon.cv.campaign_id,zhcxkj_center_adv_amazon.cv.ad_group_id,zhcxkj_center_adv_amazon.cv.ad_id
    049-
    049+ 1
    050- select_type
    050+ 100
    051-
    051+ Using index condition
    052-
    052+ 3
    053- table
    053+ UNION
    054-
    054+ cv
    055-
    055+ None
    056- partitions
    056+ range
    057-
    057+ idx_own_hour,idx_adid
    058-
    058+ idx_own_hour
    059- type
    059+ 5
    060-
    060+ None
    061-
    061+ 6218
    062- possible_keys
    062+ 33.33
    063-
    063+ Using index condition; Using where
    064-
    064+ 3
    065- key
    065+ UNION
    066-
    066+ p
    067-
    067+ None
    068- key_len
    068+ ref
    069-
    069+ uidx_ad_id
    070-
    070+ uidx_ad_id
    071- ref
    071+ 8
    072-
    072+ const
    073-
    073+ 163
    074- rows
    074+ 0.1
    075-
    075+ Using index condition
    076-
    076+
    077- filtered
    077+ 额外建议:索引列使用了函数作计算:【LENGTH(t.creative_asins) &gt;】,会导致索引失效。如果你是MySQL 8.0可以考虑创建函数索引;如果你是MySQL 5.7,你要更改你的SQL逻辑了。 索引建议: 建议添加索引:ALTER TABLE t_amazon_sb_ad_traffic ADD INDEX idx_own_hour_site_date(own_hour,site_date); 【t_amazon_sb_ad_traffic】表 【own_hour,site_date】字段,索引分析: +------------------------+--------------+---------------+---------------+ | TABLE_NAME | INDEX_NAME | COLUMN_NAME | CARDINALITY | +========================+==============+===============+===============+ | t_amazon_sb_ad_traffic | idx_adid | own_hour | 121811 | +------------------------+--------------+---------------+---------------+ | t_amazon_sb_ad_traffic | idx_own_hour | own_hour | 2368 | +------------------------+--------------+---------------+---------------+ 建议添加索引:ALTER TABLE t_sb_ad_product ADD INDEX idx_source_id_creative_asins(source_id,creative_asins); 【t_sb_ad_product】表 【source_id,creative_asins】字段,索引分析: +-----------------+--------------+---------------+---------------+ | TABLE_NAME | INDEX_NAME | COLUMN_NAME | CARDINALITY | +=================+==============+===============+===============+ | t_sb_ad_product | uidx_ad_id | source_id | 45 | +-----------------+--------------+---------------+---------------+ 建议添加索引:ALTER TABLE t_amazon_sb_ad_traffic ADD INDEX idx_own_hour_site_date(own_hour,site_date); 【t_amazon_sb_ad_traffic】表 【own_hour,site_date】字段,索引分析: +------------------------+--------------+---------------+---------------+ | TABLE_NAME | INDEX_NAME | COLUMN_NAME | CARDINALITY | +========================+==============+===============+===============+ | t_amazon_sb_ad_traffic | idx_adid | own_hour | 121811 | +------------------------+--------------+---------------+---------------+ | t_amazon_sb_ad_traffic | idx_own_hour | own_hour | 2368 | +------------------------+--------------+---------------+---------------+ 建议添加索引:ALTER TABLE t_sb_ad_product ADD INDEX idx_source_id_creative_asins(source_id,creative_asins); 【t_sb_ad_product】表 【source_id,creative_asins】字段,索引分析: +-----------------+--------------+---------------+---------------+ | TABLE_NAME | INDEX_NAME | COLUMN_NAME | CARDINALITY | +=================+==============+===============+===============+ | t_sb_ad_product | uidx_ad_id | source_id | 45 | +-----------------+--------------+---------------+---------------+问题2:
    078-
    078+ 数据库:zhcxkj_center_bi查询时间:14.7593扫描行数:292326发送行数:247.826指纹SQL:
    079-
    079+ SELECT id , report_date , source_id , customer_id , parent_asin ,
    080- Extra
    080+ child_asin , units_ordered , units_ordered_b2b ,
    081-
    081+ ordered_product_sales_amount , ordered_product_sales_currency_code ,
    082-
    082+ ordered_product_sales_b2b_amount ,
    083-
    083+ ordered_product_sales_b2b_currency_code , total_order_items ,
    084-
    084+ total_order_items_b2b , browser_sessions , browser_sessions_b2b ,
    085-
    085+ mobile_app_sessions , mobile_app_sessions_b2b , sessions , sessions_b2b ,
    086-
    086+ browser_session_percentage , browser_session_percentage_b2b ,
    087- 1
    087+ mobile_app_session_percentage , mobile_app_session_percentage_b2b ,
    088-
    088+ session_percentage , session_percentage_b2b , browser_page_views ,
    089-
    089+ browser_page_views_b2b , mobile_app_page_views ,
    090- PRIMARY
    090+ mobile_app_page_views_b2b , page_views , page_views_b2b ,
    091-
    091+ browser_page_views_percentage , browser_page_views_percentage_b2b ,
    092-
    092+ mobile_app_page_views_percentage , mobile_app_page_views_percentage_b2b ,
    093- &lt;derived2&gt;
    093+ page_views_percentage , page_views_percentage_b2b , buy_box_percentage ,
    094-
    094+ buy_box_percentage_b2b , unit_session_percentage ,
    095-
    095+ unit_session_percentage_b2b , update_time FROM ? WHERE id in ( SELECT id
    096- None
    096+ FROM ? WHERE source_id IN ( ? ) AND update_time &gt;= ? AND update_time
    097-
    097+ &lt;= ? ) ORDER BY id asc LIMIT ? ;真实SQL:SELECT id,
    098-
    098+ report_date, source_id, customer_id,
    099- ALL
    099+ parent_asin, child_asin,
    100-
    100+ units_ordered, units_ordered_b2b,
    101-
    101+ ordered_product_sales_amount,
    102- None
    102+ ordered_product_sales_currency_code,
    103-
    103+ ordered_product_sales_b2b_amount,
    104-
    104+ ordered_product_sales_b2b_currency_code, total_order_items,
    105- None
    105+ total_order_items_b2b, browser_sessions,
    106-
    106+ browser_sessions_b2b, mobile_app_sessions,
    107-
    107+ mobile_app_sessions_b2b, sessions, sessions_b2b,
    108- None
    108+ browser_session_percentage,
    109-
    109+ browser_session_percentage_b2b,
    110-
    110+ mobile_app_session_percentage,
    111- None
    111+ mobile_app_session_percentage_b2b, session_percentage,
    112-
    112+ session_percentage_b2b, browser_page_views,
    113-
    113+ browser_page_views_b2b, mobile_app_page_views,
    114- 434
    114+ mobile_app_page_views_b2b, page_views,
    115-
    115+ page_views_b2b, browser_page_views_percentage,
    116-
    116+ browser_page_views_percentage_b2b,
    117- 100
    117+ mobile_app_page_views_percentage,
    118-
    118+ mobile_app_page_views_percentage_b2b, page_views_percentage,
    119-
    119+ page_views_percentage_b2b, buy_box_percentage,
    120- Using where
    120+ buy_box_percentage_b2b, unit_session_percentage,
    121-
    121+ unit_session_percentage_b2b, update_time
    122-
    122+ FROM t_amz_sales_and_traffic_report_asin WHERE
    123-
    123+ id in ( SELECT id FROM
    124-
    124+ t_amz_sales_and_traffic_report_asin WHERE
    125- 2
    125+ source_id IN ( 6153 )
    126-
    126+ AND update_time &gt;= 2025-08-05 00:00:00
    127-
    127+ AND update_time &lt;= 2025-08-05 23:59:59 ) ORDER BY id asc LIMIT
    128- DERIVED
    128+ 300;无人工修改AISQL修改建议:SELECT t1.id, t1.report_date, t1.source_id,
    129-
    129+ t1.customer_id, t1.parent_asin, t1.child_asin, t1.units_ordered,
    130-
    130+ t1.units_ordered_b2b, t1.ordered_product_sales_amount,
    131- cv
    131+ t1.ordered_product_sales_currency_code,
    132-
    132+ t1.ordered_product_sales_b2b_amount,
    133-
    133+ t1.ordered_product_sales_b2b_currency_code, t1.total_order_items,
    134- None
    134+ t1.total_order_items_b2b, t1.browser_sessions, t1.browser_sessions_b2b,
    135-
    135+ t1.mobile_app_sessions, t1.mobile_app_sessions_b2b, t1.sessions,
    136-
    136+ t1.sessions_b2b, t1.browser_session_percentage,
    137- range
    137+ t1.browser_session_percentage_b2b, t1.mobile_app_session_percentage,
    138-
    138+ t1.mobile_app_session_percentage_b2b, t1.session_percentage,
    139-
    139+ t1.session_percentage_b2b, t1.browser_page_views,
    140- idx_adid,idx_own_hour
    140+ t1.browser_page_views_b2b, t1.mobile_app_page_views,
    141-
    141+ t1.mobile_app_page_views_b2b, t1.page_views, t1.page_views_b2b,
    142-
    142+ t1.browser_page_views_percentage, t1.browser_page_views_percentage_b2b,
    143- idx_own_hour
    143+ t1.mobile_app_page_views_percentage,
    144-
    144+ t1.mobile_app_page_views_percentage_b2b, t1.page_views_percentage,
    145-
    145+ t1.page_views_percentage_b2b, t1.buy_box_percentage,
    146- 5
    146+ t1.buy_box_percentage_b2b, t1.unit_session_percentage,
    147-
    147+ t1.unit_session_percentage_b2b, t1.update_time FROM
    148-
    148+ t_amz_sales_and_traffic_report_asin t1 JOIN (SELECT id FROM
    149- None
    149+ t_amz_sales_and_traffic_report_asin WHERE source_id = 6153 AND
    150-
    150+ update_time BETWEEN 2025-08-05 00:00:00 AND 2025-08-05 23:59:59 ORDER BY
    151-
    151+ id ASC LIMIT 300) t2 ON t1.id = t2.id;explain表:id
    152- 290
    152+ select_type
    153-
    153+ table
    154-
    154+ partitions
    155- 33.33
    155+ type
    156-
    156+ possible_keys
    157-
    157+ key
    158- Using index condition; Using where
    158+ key_len
    159-
    159+ ref
    160-
    160+ rows
    161-
    161+ filtered
    162-
    162+ Extra
    163- 2
    163+ 1
    164-
    164+ SIMPLE
    165-
    165+ t_amz_sales_and_traffic_report_asin
    166- DERIVED
    166+ None
    167-
    167+ range
    168-
    168+ PRIMARY,uk_source_id_msku,idx_update_time_source_id,idx_sourceid_updatetime
    169- p
    169+ idx_sourceid_updatetime
    170-
    170+ 10
    171-
    171+ None
    172- None
    172+ 1350
    173-
    173+ 100
    174-
    174+ Using where; Using index; Using temporary; Using filesort
    175- eq_ref
    175+ 1
    176-
    176+ SIMPLE
    177-
    177+ t_amz_sales_and_traffic_report_asin
    178- uidx_ad_id
    178+ None
    179-
    179+ eq_ref
    180-
    180+ PRIMARY
    181- uidx_ad_id
    181+ PRIMARY
    182-
    182+ 8
    183-
    183+ zhcxkj_center_bi.t_amz_sales_and_traffic_report_asin.id
    184- 782
    184+ 1
    185-
    185+ 100
    186-
    186+ None
    187- const,zhcxkj_center_adv_amazon.cv.campaign_id,zhcxkj_center_adv_amazon.cv.ad_group_id,zhcxkj_center_adv_amazon.cv.ad_id
    187+
    188-
    188+ 额外建议:索引建议:建议添加索引:ALTER TABLE t_amz_sales_and_traffic_report_asin ADD INDEX idx_id_source_id_update_time(id,source_id,update_time);【t_amz_sales_and_traffic_report_asin】表 【id,source_id,update_time】字段,索引分析:+--------------------------------+--------------------------------+---------------+---------------+| TABLE_NAME | INDEX_NAME | COLUMN_NAME | CARDINALITY |+================================+================================+===============+===============+| t_amz_sales_and_traffic_report | idx_report_date_child_asin_sou | source_id | 262883712 || _asin | rce_id | | |+--------------------------------+--------------------------------+---------------+---------------+| t_amz_sales_and_traffic_report | idx_sourceid_updatetime | source_id | 447185 || _asin | | | |+--------------------------------+--------------------------------+---------------+---------------+| t_amz_sales_and_traffic_report | idx_sourceid_updatetime | update_time | 1255422 || _asin | | | |+--------------------------------+--------------------------------+---------------+---------------+| t_amz_sales_and_traffic_report | idx_update_time_source_id | source_id | 1188044 || _asin | | | |+--------------------------------+--------------------------------+---------------+---------------+| t_amz_sales_and_traffic_report | idx_update_time_source_id | update_time | 276078 || _asin | | | |+--------------------------------+--------------------------------+---------------+---------------+| t_amz_sales_and_traffic_report | PRIMARY | id | 260823952 || _asin | | | |+--------------------------------+--------------------------------+---------------+---------------+| t_amz_sales_and_traffic_report | uk_report_date_source_id_msku | source_id | 3053827 || _asin | | | |+--------------------------------+--------------------------------+---------------+---------------+| t_amz_sales_and_traffic_report | uk_source_id_msku | source_id | 607146 || _asin | | | |+--------------------------------+--------------------------------+---------------+---------------+
    189-
    190- 1
    191-
    192-
    193- 100
    194-
    195-
    196- Using index condition
    197-
    198-
    199-
    200-
    201- 3
    202-
    203-
    204- UNION
    205-
    206-
    207- cv
    208-
    209-
    210- None
    211-
    212-
    213- range
    214-
    215-
    216- idx_own_hour,idx_adid
    217-
    218-
    219- idx_own_hour
    220-
    221-
    222- 5
    223-
    224-
    225- None
    226-
    227-
    228- 6218
    229-
    230-
    231- 33.33
    232-
    233-
    234- Using index condition; Using where
    235-
    236-
    237-
    238-
    239- 3
    240-
    241-
    242- UNION
    243-
    244-
    245- p
    246-
    247-
    248- None
    249-
    250-
    251- ref
    252-
    253-
    254- uidx_ad_id
    255-
    256-
    257- uidx_ad_id
    258-
    259-
    260- 8
    261-
    262-
    263- const
    264-
    265-
    266- 163
    267-
    268-
    269- 0.1
    270-
    271-
    272- Using index condition
    273-
    274-
    275-
    276-
    277-
    278- 额外建议:索引列使用了函数作计算:【LENGTH(t.creative_asins) &gt;】,会导致索引失效。如果你是MySQL 8.0可以考虑创建函数索引;如果你是MySQL 5.7,你要更改你的SQL逻辑了。
    279-
    280- 索引建议:
    281- 建议添加索引:ALTER TABLE t_amazon_sb_ad_traffic ADD INDEX idx_own_hour_site_date(own_hour,site_date);
    282-
    283- 【t_amazon_sb_ad_traffic】表 【own_hour,site_date】字段,索引分析:
    284- +------------------------+--------------+---------------+---------------+
    285- | TABLE_NAME | INDEX_NAME | COLUMN_NAME | CARDINALITY |
    286- +========================+==============+===============+===============+
    287- | t_amazon_sb_ad_traffic | idx_adid | own_hour | 121811 |
    288- +------------------------+--------------+---------------+---------------+
    289- | t_amazon_sb_ad_traffic | idx_own_hour | own_hour | 2368 |
    290- +------------------------+--------------+---------------+---------------+
    291-
    292- 建议添加索引:ALTER TABLE t_sb_ad_product ADD INDEX idx_source_id_creative_asins(source_id,creative_asins);
    293-
    294- 【t_sb_ad_product】表 【source_id,creative_asins】字段,索引分析:
    295- +-----------------+--------------+---------------+---------------+
    296- | TABLE_NAME | INDEX_NAME | COLUMN_NAME | CARDINALITY |
    297- +=================+==============+===============+===============+
    298- | t_sb_ad_product | uidx_ad_id | source_id | 45 |
    299- +-----------------+--------------+---------------+---------------+
    300-
    301- 建议添加索引:ALTER TABLE t_amazon_sb_ad_traffic ADD INDEX idx_own_hour_site_date(own_hour,site_date);
    302-
    303- 【t_amazon_sb_ad_traffic】表 【own_hour,site_date】字段,索引分析:
    304- +------------------------+--------------+---------------+---------------+
    305- | TABLE_NAME | INDEX_NAME | COLUMN_NAME | CARDINALITY |
    306- +========================+==============+===============+===============+
    307- | t_amazon_sb_ad_traffic | idx_adid | own_hour | 121811 |
    308- +------------------------+--------------+---------------+---------------+
    309- | t_amazon_sb_ad_traffic | idx_own_hour | own_hour | 2368 |
    310- +------------------------+--------------+---------------+---------------+
    311-
    312- 建议添加索引:ALTER TABLE t_sb_ad_product ADD INDEX idx_source_id_creative_asins(source_id,creative_asins);
    313-
    314- 【t_sb_ad_product】表 【source_id,creative_asins】字段,索引分析:
    315- +-----------------+--------------+---------------+---------------+
    316- | TABLE_NAME | INDEX_NAME | COLUMN_NAME | CARDINALITY |
    317- +=================+==============+===============+===============+
    318- | t_sb_ad_product | uidx_ad_id | source_id | 45 |
    319- +-----------------+--------------+---------------+---------------+
    320-
    321-
    001- 反馈人:袁慧斌<br />
    001+ <p>反馈人:袁慧斌</p>
    002- 数据库:zhcxkj_center_adv_amazon<br />
    002+ <p>问题1:</p>
    003- 查询时间:10.1304<br />
    003+ 数据库:zhcxkj_center_adv_amazon<br />
    004- 扫描行数:914.98<br />
    004+ 查询时间:10.1304<br /> 扫描行数:914.98<br /> 发送行数:1<br /> 指纹SQL: select count ( DISTINCT source_id , ad_id , ad_group_id , campaign_id , site_hour ) from ( select p . source_id , p . ad_id , p . ad_group_id , p . campaign_id , cv . site_hour , p . creative_asins FROM ? p left join t_amazon_sb_advertisement cv on p . ad_id = cv . ad_id and p . ad_group_id = cv . ad_group_id and p . campaign_id = cv . campaign_id where p . source_id = ? and cv . own_hour &gt;= ? and cv . own_hour &lt;= ? and cv . site_date &gt;= ? UNION all select p . source_id , p . ad_id , p . ad_group_id , p . campaign_id , cv . site_hour , p . creative_asins FROM ? p left join t_amazon_sb_ad_traffic cv on p . ad_id = cv . ad_id and p . ad_group_id = cv . ad_group_id and p . campaign_id = cv . campaign_id where p . source_id = ? and cv . own_hour &gt;= ? and cv . own_hour &lt;= ? and cv . site_date &gt;= ? ) t where LENGTH ( t . creative_asins ) &gt; ? ;<br /> 真实SQL:select count(DISTINCT source_id, ad_id, ad_group_id, campaign_id, site_hour) from( select p.source_id, p.ad_id, p.ad_group_id, p.campaign_id, cv.site_hour, p.creative_asins from t_sb_ad_product p left join t_amazon_sb_advertisement cv on p.ad_id = cv.ad_id and p.ad_group_id = cv.ad_group_id and p.campaign_id = cv.campaign_id where p.source_id = 16549 and cv.own_hour &gt;= 2025080405 and cv.own_hour &lt;= 2025080408 and cv.site_date &gt;= 2025-06-10 UNION all select p.source_id, p.ad_id, p.ad_group_id, p.campaign_id, cv.site_hour, p.creative_asins from t_sb_ad_product p left join t_amazon_sb_ad_traffic cv on p.ad_id = cv.ad_id and p.ad_group_id = cv.ad_group_id and p.campaign_id = cv.campaign_id where p.source_id = 16549 and cv.own_hour &gt;= 2025080405 and cv.own_hour &lt;= 2025080408 and cv.site_date &gt;= 2025-06-10 ) t where LENGTH(t.creative_asins) &gt;2;<br /> 无人工修改<br /> AISQL修改建议:SELECT COUNT(*) FROM (<br /> SELECT DISTINCT p.source_id, p.ad_id, p.ad_group_id, p.campaign_id, cv.site_hour<br /> FROM t_sb_ad_product p<br /> INNER JOIN t_amazon_sb_advertisement cv ON p.ad_id = cv.ad_id <br /> AND p.ad_group_id = cv.ad_group_id <br /> AND p.campaign_id = cv.campaign_id<br /> WHERE p.source_id = 16549 <br /> AND cv.own_hour BETWEEN 2025080405 AND 2025080408<br /> AND cv.site_date &gt;= 2025-06-10<br /> AND LENGTH(p.creative_asins) &gt; 2<br /><br /> UNION<br /><br /> SELECT DISTINCT p.source_id, p.ad_id, p.ad_group_id, p.campaign_id, cv.site_hour<br /> FROM t_sb_ad_product p<br /> INNER JOIN t_amazon_sb_ad_traffic cv ON p.ad_id = cv.ad_id <br /> AND p.ad_group_id = cv.ad_group_id <br /> AND p.campaign_id = cv.campaign_id<br /> WHERE p.source_id = 16549 <br /> AND cv.own_hour BETWEEN 2025080405 AND 2025080408<br /> AND cv.site_date &gt;= 2025-06-10<br /> AND LENGTH(p.creative_asins) &gt; 2<br /> ) t;<br /> explain表:<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><table><tbody><tr><th>id</th>
    005- 发送行数:1<br />
    005+ <th>select_type</th>
    006- 指纹SQL: select count ( DISTINCT source_id , ad_id , ad_group_id , campaign_id , site_hour ) from ( select p . source_id , p . ad_id , p . ad_group_id , p . campaign_id , cv . site_hour , p . creative_asins FROM ? p left join t_amazon_sb_advertisement cv on p . ad_id = cv . ad_id and p . ad_group_id = cv . ad_group_id and p . campaign_id = cv . campaign_id where p . source_id = ? and cv . own_hour &gt;= ? and cv . own_hour &lt;= ? and cv . site_date &gt;= ? UNION all select p . source_id , p . ad_id , p . ad_group_id , p . campaign_id , cv . site_hour , p . creative_asins FROM ? p left join t_amazon_sb_ad_traffic cv on p . ad_id = cv . ad_id and p . ad_group_id = cv . ad_group_id and p . campaign_id = cv . campaign_id where p . source_id = ? and cv . own_hour &gt;= ? and cv . own_hour &lt;= ? and cv . site_date &gt;= ? ) t where LENGTH ( t . creative_asins ) &gt; ? ;<br />
    006+ <th>table</th>
    007- 真实SQL:select count(DISTINCT source_id, ad_id, ad_group_id, campaign_id, site_hour) from( select p.source_id, p.ad_id, p.ad_group_id, p.campaign_id, cv.site_hour, p.creative_asins from t_sb_ad_product p left join t_amazon_sb_advertisement cv on p.ad_id = cv.ad_id and p.ad_group_id = cv.ad_group_id and p.campaign_id = cv.campaign_id where p.source_id = 16549 and cv.own_hour &gt;= 2025080405 and cv.own_hour &lt;= 2025080408 and cv.site_date &gt;= 2025-06-10 UNION all select p.source_id, p.ad_id, p.ad_group_id, p.campaign_id, cv.site_hour, p.creative_asins from t_sb_ad_product p left join t_amazon_sb_ad_traffic cv on p.ad_id = cv.ad_id and p.ad_group_id = cv.ad_group_id and p.campaign_id = cv.campaign_id where p.source_id = 16549 and cv.own_hour &gt;= 2025080405 and cv.own_hour &lt;= 2025080408 and cv.site_date &gt;= 2025-06-10 ) t where LENGTH(t.creative_asins) &gt;2;<br />
    007+ <th>partitions</th>
    008- 无人工修改<br />
    008+ <th>type</th>
    009- AISQL修改建议:SELECT COUNT(*) FROM (<br />
    009+ <th>possible_keys</th>
    010- SELECT DISTINCT p.source_id, p.ad_id, p.ad_group_id, p.campaign_id, cv.site_hour<br />
    010+ <th>key</th>
    011- FROM t_sb_ad_product p<br />
    011+ <th>key_len</th>
    012- INNER JOIN t_amazon_sb_advertisement cv ON p.ad_id = cv.ad_id <br />
    012+ <th>ref</th>
    013- AND p.ad_group_id = cv.ad_group_id <br />
    013+ <th>rows</th>
    014- AND p.campaign_id = cv.campaign_id<br />
    014+ <th>filtered</th>
    015- WHERE p.source_id = 16549 <br />
    015+ <th>Extra</th>
    016- AND cv.own_hour BETWEEN 2025080405 AND 2025080408<br />
    016+ </tr></tbody><tbody><tr><td>1</td>
    017- AND cv.site_date &gt;= 2025-06-10<br />
    017+ <td>PRIMARY</td>
    018- AND LENGTH(p.creative_asins) &gt; 2<br />
    018+ <td>&lt;derived2&gt;</td>
    019- <br />
    019+ <td>None</td>
    020- UNION<br />
    020+ <td>ALL</td>
    021- <br />
    021+ <td>None</td>
    022- SELECT DISTINCT p.source_id, p.ad_id, p.ad_group_id, p.campaign_id, cv.site_hour<br />
    022+ <td>None</td>
    023- FROM t_sb_ad_product p<br />
    023+ <td>None</td>
    024- INNER JOIN t_amazon_sb_ad_traffic cv ON p.ad_id = cv.ad_id <br />
    024+ <td>None</td>
    025- AND p.ad_group_id = cv.ad_group_id <br />
    025+ <td>434</td>
    026- AND p.campaign_id = cv.campaign_id<br />
    026+ <td>100</td>
    027- WHERE p.source_id = 16549 <br />
    027+ <td>Using where</td>
    028- AND cv.own_hour BETWEEN 2025080405 AND 2025080408<br />
    028+ </tr><tr><td>2</td>
    029- AND cv.site_date &gt;= 2025-06-10<br />
    029+ <td>DERIVED</td>
    030- AND LENGTH(p.creative_asins) &gt; 2<br />
    030+ <td>cv</td>
    031- ) t;<br />
    031+ <td>None</td>
    032- explain表:<br />
    032+ <td>range</td>
    033- <br />
    033+ <td>idx_adid,idx_own_hour</td>
    034- <br />
    034+ <td>idx_own_hour</td>
    035- <br />
    035+ <td>5</td>
    036- <br />
    036+ <td>None</td>
    037- <br />
    037+ <td>290</td>
    038- <br />
    038+ <td>33.33</td>
    039- <br />
    039+ <td>Using index condition; Using where</td>
    040- <br />
    040+ </tr><tr><td>2</td>
    041- <br />
    041+ <td>DERIVED</td>
    042- <br />
    042+ <td>p</td>
    043- <table>
    043+ <td>None</td>
    044- <tbody>
    044+ <td>eq_ref</td>
    045- <tr>
    045+ <td>uidx_ad_id</td>
    046- <th>
    046+ <td>uidx_ad_id</td>
    047- id
    047+ <td>782</td>
    048- </th>
    048+ <td>const,zhcxkj_center_adv_amazon.cv.campaign_id,zhcxkj_center_adv_amazon.cv.ad_group_id,zhcxkj_center_adv_amazon.cv.ad_id</td>
    049- <th>
    049+ <td>1</td>
    050- select_type
    050+ <td>100</td>
    051- </th>
    051+ <td>Using index condition</td>
    052- <th>
    052+ </tr><tr><td>3</td>
    053- table
    053+ <td>UNION</td>
    054- </th>
    054+ <td>cv</td>
    055- <th>
    055+ <td>None</td>
    056- partitions
    056+ <td>range</td>
    057- </th>
    057+ <td>idx_own_hour,idx_adid</td>
    058- <th>
    058+ <td>idx_own_hour</td>
    059- type
    059+ <td>5</td>
    060- </th>
    060+ <td>None</td>
    061- <th>
    061+ <td>6218</td>
    062- possible_keys
    062+ <td>33.33</td>
    063- </th>
    063+ <td>Using index condition; Using where</td>
    064- <th>
    064+ </tr><tr><td>3</td>
    065- key
    065+ <td>UNION</td>
    066- </th>
    066+ <td>p</td>
    067- <th>
    067+ <td>None</td>
    068- key_len
    068+ <td>ref</td>
    069- </th>
    069+ <td>uidx_ad_id</td>
    070- <th>
    070+ <td>uidx_ad_id</td>
    071- ref
    071+ <td>8</td>
    072- </th>
    072+ <td>const</td>
    073- <th>
    073+ <td>163</td>
    074- rows
    074+ <td>0.1</td>
    075- </th>
    075+ <td>Using index condition</td>
    076- <th>
    076+ </tr></tbody></table><br />
    077- filtered
    077+ 额外建议:索引列使用了函数作计算:【LENGTH(t.creative_asins) &gt;】,会导致索引失效。如果你是MySQL 8.0可以考虑创建函数索引;如果你是MySQL 5.7,你要更改你的SQL逻辑了。<br /><br /> 索引建议:<span style="color:#FFA500;"><br /> 建议添加索引:ALTER TABLE t_amazon_sb_ad_traffic ADD INDEX idx_own_hour_site_date(own_hour,site_date);</span><br /><br /> 【t_amazon_sb_ad_traffic】表 【own_hour,site_date】字段,索引分析:<br /> +------------------------+--------------+---------------+---------------+<br /> | TABLE_NAME | INDEX_NAME | COLUMN_NAME | CARDINALITY |<br /> +========================+==============+===============+===============+<br /> | t_amazon_sb_ad_traffic | idx_adid | own_hour | 121811 |<br /> +------------------------+--------------+---------------+---------------+<br /> | t_amazon_sb_ad_traffic | idx_own_hour | own_hour | 2368 |<br /> +------------------------+--------------+---------------+---------------+<br /><span style="color:#FFA500;"><br /> 建议添加索引:ALTER TABLE t_sb_ad_product ADD INDEX idx_source_id_creative_asins(source_id,creative_asins);</span><br /><br /> 【t_sb_ad_product】表 【source_id,creative_asins】字段,索引分析:<br /> +-----------------+--------------+---------------+---------------+<br /> | TABLE_NAME | INDEX_NAME | COLUMN_NAME | CARDINALITY |<br /> +=================+==============+===============+===============+<br /> | t_sb_ad_product | uidx_ad_id | source_id | 45 |<br /> +-----------------+--------------+---------------+---------------+<br /><span style="color:#FFA500;"><br /> 建议添加索引:ALTER TABLE t_amazon_sb_ad_traffic ADD INDEX idx_own_hour_site_date(own_hour,site_date);</span><br /><br /> 【t_amazon_sb_ad_traffic】表 【own_hour,site_date】字段,索引分析:<br /> +------------------------+--------------+---------------+---------------+<br /> | TABLE_NAME | INDEX_NAME | COLUMN_NAME | CARDINALITY |<br /> +========================+==============+===============+===============+<br /> | t_amazon_sb_ad_traffic | idx_adid | own_hour | 121811 |<br /> +------------------------+--------------+---------------+---------------+<br /> | t_amazon_sb_ad_traffic | idx_own_hour | own_hour | 2368 |<br /> +------------------------+--------------+---------------+---------------+<br /><span style="color:#FFA500;"><br /> 建议添加索引:ALTER TABLE t_sb_ad_product ADD INDEX idx_source_id_creative_asins(source_id,creative_asins);</span><br /><br /> 【t_sb_ad_product】表 【source_id,creative_asins】字段,索引分析:<br /> +-----------------+--------------+---------------+---------------+<br /> | TABLE_NAME | INDEX_NAME | COLUMN_NAME | CARDINALITY |<br /> +=================+==============+===============+===============+<br /> | t_sb_ad_product | uidx_ad_id | source_id | 45 |<br /> +-----------------+--------------+---------------+---------------+<br /><br /><p>问题2:</p>
    078- </th>
    078+ <p>数据库:zhcxkj_center_bi<br />查询时间:14.7593<br />扫描行数:292326<br />发送行数:247.826<br />指纹SQL:
    079- <th>
    079+ SELECT id , report_date , source_id , customer_id , parent_asin ,
    080- Extra
    080+ child_asin , units_ordered , units_ordered_b2b ,
    081- </th>
    081+ ordered_product_sales_amount , ordered_product_sales_currency_code ,
    082- </tr>
    082+ ordered_product_sales_b2b_amount ,
    083- </tbody>
    083+ ordered_product_sales_b2b_currency_code , total_order_items ,
    084- <tbody>
    084+ total_order_items_b2b , browser_sessions , browser_sessions_b2b ,
    085- <tr>
    085+ mobile_app_sessions , mobile_app_sessions_b2b , sessions , sessions_b2b ,
    086- <td>
    086+ browser_session_percentage , browser_session_percentage_b2b ,
    087- 1
    087+ mobile_app_session_percentage , mobile_app_session_percentage_b2b ,
    088- </td>
    088+ session_percentage , session_percentage_b2b , browser_page_views ,
    089- <td>
    089+ browser_page_views_b2b , mobile_app_page_views ,
    090- PRIMARY
    090+ mobile_app_page_views_b2b , page_views , page_views_b2b ,
    091- </td>
    091+ browser_page_views_percentage , browser_page_views_percentage_b2b ,
    092- <td>
    092+ mobile_app_page_views_percentage , mobile_app_page_views_percentage_b2b ,
    093- &lt;derived2&gt;
    093+ page_views_percentage , page_views_percentage_b2b , buy_box_percentage ,
    094- </td>
    094+ buy_box_percentage_b2b , unit_session_percentage ,
    095- <td>
    095+ unit_session_percentage_b2b , update_time FROM ? WHERE id in ( SELECT id
    096- None
    096+ FROM ? WHERE source_id IN ( ? ) AND update_time &gt;= ? AND update_time
    097- </td>
    097+ &lt;= ? ) ORDER BY id asc LIMIT ? ;<br />真实SQL:SELECT id,
    098- <td>
    098+ report_date, source_id, customer_id,
    099- ALL
    099+ parent_asin, child_asin,
    100- </td>
    100+ units_ordered, units_ordered_b2b,
    101- <td>
    101+ ordered_product_sales_amount,
    102- None
    102+ ordered_product_sales_currency_code,
    103- </td>
    103+ ordered_product_sales_b2b_amount,
    104- <td>
    104+ ordered_product_sales_b2b_currency_code, total_order_items,
    105- None
    105+ total_order_items_b2b, browser_sessions,
    106- </td>
    106+ browser_sessions_b2b, mobile_app_sessions,
    107- <td>
    107+ mobile_app_sessions_b2b, sessions, sessions_b2b,
    108- None
    108+ browser_session_percentage,
    109- </td>
    109+ browser_session_percentage_b2b,
    110- <td>
    110+ mobile_app_session_percentage,
    111- None
    111+ mobile_app_session_percentage_b2b, session_percentage,
    112- </td>
    112+ session_percentage_b2b, browser_page_views,
    113- <td>
    113+ browser_page_views_b2b, mobile_app_page_views,
    114- 434
    114+ mobile_app_page_views_b2b, page_views,
    115- </td>
    115+ page_views_b2b, browser_page_views_percentage,
    116- <td>
    116+ browser_page_views_percentage_b2b,
    117- 100
    117+ mobile_app_page_views_percentage,
    118- </td>
    118+ mobile_app_page_views_percentage_b2b, page_views_percentage,
    119- <td>
    119+ page_views_percentage_b2b, buy_box_percentage,
    120- Using where
    120+ buy_box_percentage_b2b, unit_session_percentage,
    121- </td>
    121+ unit_session_percentage_b2b, update_time
    122- </tr>
    122+ FROM t_amz_sales_and_traffic_report_asin WHERE
    123- <tr>
    123+ id in ( SELECT id FROM
    124- <td>
    124+ t_amz_sales_and_traffic_report_asin WHERE
    125- 2
    125+ source_id IN ( 6153 )
    126- </td>
    126+ AND update_time &gt;= 2025-08-05 00:00:00
    127- <td>
    127+ AND update_time &lt;= 2025-08-05 23:59:59 ) ORDER BY id asc LIMIT
    128- DERIVED
    128+ 300;<br />无人工修改<br />AISQL修改建议:SELECT t1.id, t1.report_date, t1.source_id,
    129- </td>
    129+ t1.customer_id, t1.parent_asin, t1.child_asin, t1.units_ordered,
    130- <td>
    130+ t1.units_ordered_b2b, t1.ordered_product_sales_amount,
    131- cv
    131+ t1.ordered_product_sales_currency_code,
    132- </td>
    132+ t1.ordered_product_sales_b2b_amount,
    133- <td>
    133+ t1.ordered_product_sales_b2b_currency_code, t1.total_order_items,
    134- None
    134+ t1.total_order_items_b2b, t1.browser_sessions, t1.browser_sessions_b2b,
    135- </td>
    135+ t1.mobile_app_sessions, t1.mobile_app_sessions_b2b, t1.sessions,
    136- <td>
    136+ t1.sessions_b2b, t1.browser_session_percentage,
    137- range
    137+ t1.browser_session_percentage_b2b, t1.mobile_app_session_percentage,
    138- </td>
    138+ t1.mobile_app_session_percentage_b2b, t1.session_percentage,
    139- <td>
    139+ t1.session_percentage_b2b, t1.browser_page_views,
    140- idx_adid,idx_own_hour
    140+ t1.browser_page_views_b2b, t1.mobile_app_page_views,
    141- </td>
    141+ t1.mobile_app_page_views_b2b, t1.page_views, t1.page_views_b2b,
    142- <td>
    142+ t1.browser_page_views_percentage, t1.browser_page_views_percentage_b2b,
    143- idx_own_hour
    143+ t1.mobile_app_page_views_percentage,
    144- </td>
    144+ t1.mobile_app_page_views_percentage_b2b, t1.page_views_percentage,
    145- <td>
    145+ t1.page_views_percentage_b2b, t1.buy_box_percentage,
    146- 5
    146+ t1.buy_box_percentage_b2b, t1.unit_session_percentage,
    147- </td>
    147+ t1.unit_session_percentage_b2b, t1.update_time FROM
    148- <td>
    148+ t_amz_sales_and_traffic_report_asin t1 JOIN (SELECT id FROM
    149- None
    149+ t_amz_sales_and_traffic_report_asin WHERE source_id = 6153 AND
    150- </td>
    150+ update_time BETWEEN 2025-08-05 00:00:00 AND 2025-08-05 23:59:59 ORDER BY
    151- <td>
    151+ id ASC LIMIT 300) t2 ON t1.id = t2.id;<br />explain表:<br /><br /><br /><br /></p><table><tbody><tr><th>id</th>
    152- 290
    152+ <th>select_type</th>
    153- </td>
    153+ <th>table</th>
    154- <td>
    154+ <th>partitions</th>
    155- 33.33
    155+ <th>type</th>
    156- </td>
    156+ <th>possible_keys</th>
    157- <td>
    157+ <th>key</th>
    158- Using index condition; Using where
    158+ <th>key_len</th>
    159- </td>
    159+ <th>ref</th>
    160- </tr>
    160+ <th>rows</th>
    161- <tr>
    161+ <th>filtered</th>
    162- <td>
    162+ <th>Extra</th>
    163- 2
    163+ </tr></tbody><tbody><tr><td>1</td>
    164- </td>
    164+ <td>SIMPLE</td>
    165- <td>
    165+ <td>t_amz_sales_and_traffic_report_asin</td>
    166- DERIVED
    166+ <td>None</td>
    167- </td>
    167+ <td>range</td>
    168- <td>
    168+ <td>PRIMARY,uk_source_id_msku,idx_update_time_source_id,idx_sourceid_updatetime</td>
    169- p
    169+ <td>idx_sourceid_updatetime</td>
    170- </td>
    170+ <td>10</td>
    171- <td>
    171+ <td>None</td>
    172- None
    172+ <td>1350</td>
    173- </td>
    173+ <td>100</td>
    174- <td>
    174+ <td>Using where; Using index; Using temporary; Using filesort</td>
    175- eq_ref
    175+ </tr><tr><td>1</td>
    176- </td>
    176+ <td>SIMPLE</td>
    177- <td>
    177+ <td>t_amz_sales_and_traffic_report_asin</td>
    178- uidx_ad_id
    178+ <td>None</td>
    179- </td>
    179+ <td>eq_ref</td>
    180- <td>
    180+ <td>PRIMARY</td>
    181- uidx_ad_id
    181+ <td>PRIMARY</td>
    182- </td>
    182+ <td>8</td>
    183- <td>
    183+ <td>zhcxkj_center_bi.t_amz_sales_and_traffic_report_asin.id</td>
    184- 782
    184+ <td>1</td>
    185- </td>
    185+ <td>100</td>
    186- <td>
    186+ <td>None</td>
    187- const,zhcxkj_center_adv_amazon.cv.campaign_id,zhcxkj_center_adv_amazon.cv.ad_group_id,zhcxkj_center_adv_amazon.cv.ad_id
    187+ </tr></tbody></table><br />
    188- </td>
    188+ 额外建议:<br />索引建议:<br />建议添加索引:ALTER TABLE t_amz_sales_and_traffic_report_asin ADD INDEX idx_id_source_id_update_time(id,source_id,update_time);<br />【t_amz_sales_and_traffic_report_asin】表 【id,source_id,update_time】字段,索引分析:<br />+--------------------------------+--------------------------------+---------------+---------------+<br />| TABLE_NAME | INDEX_NAME | COLUMN_NAME | CARDINALITY |<br />+================================+================================+===============+===============+<br />| t_amz_sales_and_traffic_report | idx_report_date_child_asin_sou | source_id | 262883712 |<br />| _asin | rce_id | | |<br />+--------------------------------+--------------------------------+---------------+---------------+<br />| t_amz_sales_and_traffic_report | idx_sourceid_updatetime | source_id | 447185 |<br />| _asin | | | |<br />+--------------------------------+--------------------------------+---------------+---------------+<br />| t_amz_sales_and_traffic_report | idx_sourceid_updatetime | update_time | 1255422 |<br />| _asin | | | |<br />+--------------------------------+--------------------------------+---------------+---------------+<br />| t_amz_sales_and_traffic_report | idx_update_time_source_id | source_id | 1188044 |<br />| _asin | | | |<br />+--------------------------------+--------------------------------+---------------+---------------+<br />| t_amz_sales_and_traffic_report | idx_update_time_source_id | update_time | 276078 |<br />| _asin | | | |<br />+--------------------------------+--------------------------------+---------------+---------------+<br />| t_amz_sales_and_traffic_report | PRIMARY | id | 260823952 |<br />| _asin | | | |<br />+--------------------------------+--------------------------------+---------------+---------------+<br />| t_amz_sales_and_traffic_report | uk_report_date_source_id_msku | source_id | 3053827 |<br />| _asin | | | |<br />+--------------------------------+--------------------------------+---------------+---------------+<br />| t_amz_sales_and_traffic_report | uk_source_id_msku | source_id | 607146 |<br />| _asin | | | |<br />+--------------------------------+--------------------------------+---------------+---------------+<br />
    189- <td>
    190- 1
    191- </td>
    192- <td>
    193- 100
    194- </td>
    195- <td>
    196- Using index condition
    197- </td>
    198- </tr>
    199- <tr>
    200- <td>
    201- 3
    202- </td>
    203- <td>
    204- UNION
    205- </td>
    206- <td>
    207- cv
    208- </td>
    209- <td>
    210- None
    211- </td>
    212- <td>
    213- range
    214- </td>
    215- <td>
    216- idx_own_hour,idx_adid
    217- </td>
    218- <td>
    219- idx_own_hour
    220- </td>
    221- <td>
    222- 5
    223- </td>
    224- <td>
    225- None
    226- </td>
    227- <td>
    228- 6218
    229- </td>
    230- <td>
    231- 33.33
    232- </td>
    233- <td>
    234- Using index condition; Using where
    235- </td>
    236- </tr>
    237- <tr>
    238- <td>
    239- 3
    240- </td>
    241- <td>
    242- UNION
    243- </td>
    244- <td>
    245- p
    246- </td>
    247- <td>
    248- None
    249- </td>
    250- <td>
    251- ref
    252- </td>
    253- <td>
    254- uidx_ad_id
    255- </td>
    256- <td>
    257- uidx_ad_id
    258- </td>
    259- <td>
    260- 8
    261- </td>
    262- <td>
    263- const
    264- </td>
    265- <td>
    266- 163
    267- </td>
    268- <td>
    269- 0.1
    270- </td>
    271- <td>
    272- Using index condition
    273- </td>
    274- </tr>
    275- </tbody>
    276- </table>
    277- <br />
    278- 额外建议:索引列使用了函数作计算:【LENGTH(t.creative_asins) &gt;】,会导致索引失效。如果你是MySQL 8.0可以考虑创建函数索引;如果你是MySQL 5.7,你要更改你的SQL逻辑了。<br />
    279- <br />
    280- 索引建议:<span style="color:FFA500;"><br />
    281- 建议添加索引:ALTER TABLE t_amazon_sb_ad_traffic ADD INDEX idx_own_hour_site_date(own_hour,site_date);</span><br />
    282- <br />
    283- 【t_amazon_sb_ad_traffic】表 【own_hour,site_date】字段,索引分析:<br />
    284- +------------------------+--------------+---------------+---------------+<br />
    285- | TABLE_NAME | INDEX_NAME | COLUMN_NAME | CARDINALITY |<br />
    286- +========================+==============+===============+===============+<br />
    287- | t_amazon_sb_ad_traffic | idx_adid | own_hour | 121811 |<br />
    288- +------------------------+--------------+---------------+---------------+<br />
    289- | t_amazon_sb_ad_traffic | idx_own_hour | own_hour | 2368 |<br />
    290- +------------------------+--------------+---------------+---------------+<br />
    291- <span style="color:FFA500;"><br />
    292- 建议添加索引:ALTER TABLE t_sb_ad_product ADD INDEX idx_source_id_creative_asins(source_id,creative_asins);</span><br />
    293- <br />
    294- 【t_sb_ad_product】表 【source_id,creative_asins】字段,索引分析:<br />
    295- +-----------------+--------------+---------------+---------------+<br />
    296- | TABLE_NAME | INDEX_NAME | COLUMN_NAME | CARDINALITY |<br />
    297- +=================+==============+===============+===============+<br />
    298- | t_sb_ad_product | uidx_ad_id | source_id | 45 |<br />
    299- +-----------------+--------------+---------------+---------------+<br />
    300- <span style="color:FFA500;"><br />
    301- 建议添加索引:ALTER TABLE t_amazon_sb_ad_traffic ADD INDEX idx_own_hour_site_date(own_hour,site_date);</span><br />
    302- <br />
    303- 【t_amazon_sb_ad_traffic】表 【own_hour,site_date】字段,索引分析:<br />
    304- +------------------------+--------------+---------------+---------------+<br />
    305- | TABLE_NAME | INDEX_NAME | COLUMN_NAME | CARDINALITY |<br />
    306- +========================+==============+===============+===============+<br />
    307- | t_amazon_sb_ad_traffic | idx_adid | own_hour | 121811 |<br />
    308- +------------------------+--------------+---------------+---------------+<br />
    309- | t_amazon_sb_ad_traffic | idx_own_hour | own_hour | 2368 |<br />
    310- +------------------------+--------------+---------------+---------------+<br />
    311- <span style="color:FFA500;"><br />
    312- 建议添加索引:ALTER TABLE t_sb_ad_product ADD INDEX idx_source_id_creative_asins(source_id,creative_asins);</span><br />
    313- <br />
    314- 【t_sb_ad_product】表 【source_id,creative_asins】字段,索引分析:<br />
    315- +-----------------+--------------+---------------+---------------+<br />
    316- | TABLE_NAME | INDEX_NAME | COLUMN_NAME | CARDINALITY |<br />
    317- +=================+==============+===============+===============+<br />
    318- | t_sb_ad_product | uidx_ad_id | source_id | 45 |<br />
    319- +-----------------+--------------+---------------+---------------+<br />
    320- <br />
    321- <br />
  3. 2025-08-06 13:42:30, 由 覃光贤 指派给 陈莉珍。
    修改了 指派给,旧值为 "qinguangxian",新值为 "chenlizhen"。

    第一个问题SQL都是秒出的,不是慢SQL


    第二个问题是因为表数据量过大,已经发通知了,后续会分表,预计下周上线

  4. 2025-08-06 16:37:35, 由 陈莉珍 编辑。
    修改了 开发责任人,旧值为 "",新值为 "qinguangxian"。
    修改了 测试责任人,旧值为 "",新值为 "qinguangxian"。
    修改了 解决时效 ,旧值为 "0",新值为 "NaN"。
    修改了 上线时间 ,旧值为 "0000-00-00 00:00:00",新值为 "2025-08-06 13:45"。
    修改了 上线时效 ,旧值为 "-1",新值为 "1.06"。
    修改了 重现步骤 ,区别为:
    151- id ASC LIMIT 300) t2 ON t1.id = t2.id;explain表:id
    151+ id ASC LIMIT 300) t2 ON t1.id = t2.id;explain表:
    152- select_type
    152+ id
    153- table
    153+ select_type
    154- partitions
    154+ table
    155- type
    155+ partitions
    156- possible_keys
    156+ type
    157- key
    157+ possible_keys
    158- key_len
    158+ key
    159- ref
    159+ key_len
    160- rows
    160+ ref
    161- filtered
    161+ rows
    162- Extra
    162+ filtered
    163- 1
    163+ Extra
    164- SIMPLE
    164+ 1
    165- t_amz_sales_and_traffic_report_asin
    165+ SIMPLE
    166- None
    166+ t_amz_sales_and_traffic_report_asin
    167- range
    167+ None
    168- PRIMARY,uk_source_id_msku,idx_update_time_source_id,idx_sourceid_updatetime
    168+ range
    169- idx_sourceid_updatetime
    169+ PRIMARY,uk_source_id_msku,idx_update_time_source_id,idx_sourceid_updatetime
    170- 10
    170+ idx_sourceid_updatetime
    171- None
    171+ 10
    172- 1350
    172+ None
    173- 100
    173+ 1350
    174- Using where; Using index; Using temporary; Using filesort
    174+ 100
    175- 1
    175+ Using where; Using index; Using temporary; Using filesort
    176- SIMPLE
    176+ 1
    177- t_amz_sales_and_traffic_report_asin
    177+ SIMPLE
    178- None
    178+ t_amz_sales_and_traffic_report_asin
    179- eq_ref
    179+ None
    180- PRIMARY
    180+ eq_ref
    181- PRIMARY
    181+ PRIMARY
    182- 8
    182+ PRIMARY
    183- zhcxkj_center_bi.t_amz_sales_and_traffic_report_asin.id
    183+ 8
    184- 1
    184+ zhcxkj_center_bi.t_amz_sales_and_traffic_report_asin.id
    185- 100
    185+ 1
    186- None
    186+ 100
    187-
    187+ None
    188- 额外建议:索引建议:建议添加索引:ALTER TABLE t_amz_sales_and_traffic_report_asin ADD INDEX idx_id_source_id_update_time(id,source_id,update_time);【t_amz_sales_and_traffic_report_asin】表 【id,source_id,update_time】字段,索引分析:+--------------------------------+--------------------------------+---------------+---------------+| TABLE_NAME | INDEX_NAME | COLUMN_NAME | CARDINALITY |+================================+================================+===============+===============+| t_amz_sales_and_traffic_report | idx_report_date_child_asin_sou | source_id | 262883712 || _asin | rce_id | | |+--------------------------------+--------------------------------+---------------+---------------+| t_amz_sales_and_traffic_report | idx_sourceid_updatetime | source_id | 447185 || _asin | | | |+--------------------------------+--------------------------------+---------------+---------------+| t_amz_sales_and_traffic_report | idx_sourceid_updatetime | update_time | 1255422 || _asin | | | |+--------------------------------+--------------------------------+---------------+---------------+| t_amz_sales_and_traffic_report | idx_update_time_source_id | source_id | 1188044 || _asin | | | |+--------------------------------+--------------------------------+---------------+---------------+| t_amz_sales_and_traffic_report | idx_update_time_source_id | update_time | 276078 || _asin | | | |+--------------------------------+--------------------------------+---------------+---------------+| t_amz_sales_and_traffic_report | PRIMARY | id | 260823952 || _asin | | | |+--------------------------------+--------------------------------+---------------+---------------+| t_amz_sales_and_traffic_report | uk_report_date_source_id_msku | source_id | 3053827 || _asin | | | |+--------------------------------+--------------------------------+---------------+---------------+| t_amz_sales_and_traffic_report | uk_source_id_msku | source_id | 607146 || _asin | | | |+--------------------------------+--------------------------------+---------------+---------------+
    188+
    189+ 额外建议:索引建议:建议添加索引:ALTER TABLE t_amz_sales_and_traffic_report_asin ADD INDEX idx_id_source_id_update_time(id,source_id,update_time);【t_amz_sales_and_traffic_report_asin】表 【id,source_id,update_time】字段,索引分析:+--------------------------------+--------------------------------+---------------+---------------+| TABLE_NAME | INDEX_NAME | COLUMN_NAME | CARDINALITY |+================================+================================+===============+===============+| t_amz_sales_and_traffic_report | idx_report_date_child_asin_sou | source_id | 262883712 || _asin | rce_id | | |+--------------------------------+--------------------------------+---------------+---------------+| t_amz_sales_and_traffic_report | idx_sourceid_updatetime | source_id | 447185 || _asin | | | |+--------------------------------+--------------------------------+---------------+---------------+| t_amz_sales_and_traffic_report | idx_sourceid_updatetime | update_time | 1255422 || _asin | | | |+--------------------------------+--------------------------------+---------------+---------------+| t_amz_sales_and_traffic_report | idx_update_time_source_id | source_id | 1188044 || _asin | | | |+--------------------------------+--------------------------------+---------------+---------------+| t_amz_sales_and_traffic_report | idx_update_time_source_id | update_time | 276078 || _asin | | | |+--------------------------------+--------------------------------+---------------+---------------+| t_amz_sales_and_traffic_report | PRIMARY | id | 260823952 || _asin | | | |+--------------------------------+--------------------------------+---------------+---------------+| t_amz_sales_and_traffic_report | uk_report_date_source_id_msku | source_id | 3053827 || _asin | | | |+--------------------------------+--------------------------------+---------------+---------------+| t_amz_sales_and_traffic_report | uk_source_id_msku | source_id | 607146 || _asin | | | |+--------------------------------+--------------------------------+---------------+---------------+
    151- id ASC LIMIT 300) t2 ON t1.id = t2.id;<br />explain表:<br /><br /><br /><br /></p><table><tbody><tr><th>id</th>
    151+ id ASC LIMIT 300) t2 ON t1.id = t2.id;<br />explain表:<br /><br /></p>
    152- <th>select_type</th>
    152+ <table><tbody><tr><th>id</th>
    153- <th>table</th>
    153+ <th>select_type</th>
    154- <th>partitions</th>
    154+ <th>table</th>
    155- <th>type</th>
    155+ <th>partitions</th>
    156- <th>possible_keys</th>
    156+ <th>type</th>
    157- <th>key</th>
    157+ <th>possible_keys</th>
    158- <th>key_len</th>
    158+ <th>key</th>
    159- <th>ref</th>
    159+ <th>key_len</th>
    160- <th>rows</th>
    160+ <th>ref</th>
    161- <th>filtered</th>
    161+ <th>rows</th>
    162- <th>Extra</th>
    162+ <th>filtered</th>
    163- </tr></tbody><tbody><tr><td>1</td>
    163+ <th>Extra</th>
    164- <td>SIMPLE</td>
    164+ </tr></tbody><tbody><tr><td>1</td>
    165- <td>t_amz_sales_and_traffic_report_asin</td>
    165+ <td>SIMPLE</td>
    166- <td>None</td>
    166+ <td>t_amz_sales_and_traffic_report_asin</td>
    167- <td>range</td>
    167+ <td>None</td>
    168- <td>PRIMARY,uk_source_id_msku,idx_update_time_source_id,idx_sourceid_updatetime</td>
    168+ <td>range</td>
    169- <td>idx_sourceid_updatetime</td>
    169+ <td>PRIMARY,uk_source_id_msku,idx_update_time_source_id,idx_sourceid_updatetime</td>
    170- <td>10</td>
    170+ <td>idx_sourceid_updatetime</td>
    171- <td>None</td>
    171+ <td>10</td>
    172- <td>1350</td>
    172+ <td>None</td>
    173- <td>100</td>
    173+ <td>1350</td>
    174- <td>Using where; Using index; Using temporary; Using filesort</td>
    174+ <td>100</td>
    175- </tr><tr><td>1</td>
    175+ <td>Using where; Using index; Using temporary; Using filesort</td>
    176- <td>SIMPLE</td>
    176+ </tr><tr><td>1</td>
    177- <td>t_amz_sales_and_traffic_report_asin</td>
    177+ <td>SIMPLE</td>
    178- <td>None</td>
    178+ <td>t_amz_sales_and_traffic_report_asin</td>
    179- <td>eq_ref</td>
    179+ <td>None</td>
    180- <td>PRIMARY</td>
    180+ <td>eq_ref</td>
    181- <td>PRIMARY</td>
    181+ <td>PRIMARY</td>
    182- <td>8</td>
    182+ <td>PRIMARY</td>
    183- <td>zhcxkj_center_bi.t_amz_sales_and_traffic_report_asin.id</td>
    183+ <td>8</td>
    184- <td>1</td>
    184+ <td>zhcxkj_center_bi.t_amz_sales_and_traffic_report_asin.id</td>
    185- <td>100</td>
    185+ <td>1</td>
    186- <td>None</td>
    186+ <td>100</td>
    187- </tr></tbody></table><br />
    187+ <td>None</td>
    188- 额外建议:<br />索引建议:<br />建议添加索引:ALTER TABLE t_amz_sales_and_traffic_report_asin ADD INDEX idx_id_source_id_update_time(id,source_id,update_time);<br />【t_amz_sales_and_traffic_report_asin】表 【id,source_id,update_time】字段,索引分析:<br />+--------------------------------+--------------------------------+---------------+---------------+<br />| TABLE_NAME | INDEX_NAME | COLUMN_NAME | CARDINALITY |<br />+================================+================================+===============+===============+<br />| t_amz_sales_and_traffic_report | idx_report_date_child_asin_sou | source_id | 262883712 |<br />| _asin | rce_id | | |<br />+--------------------------------+--------------------------------+---------------+---------------+<br />| t_amz_sales_and_traffic_report | idx_sourceid_updatetime | source_id | 447185 |<br />| _asin | | | |<br />+--------------------------------+--------------------------------+---------------+---------------+<br />| t_amz_sales_and_traffic_report | idx_sourceid_updatetime | update_time | 1255422 |<br />| _asin | | | |<br />+--------------------------------+--------------------------------+---------------+---------------+<br />| t_amz_sales_and_traffic_report | idx_update_time_source_id | source_id | 1188044 |<br />| _asin | | | |<br />+--------------------------------+--------------------------------+---------------+---------------+<br />| t_amz_sales_and_traffic_report | idx_update_time_source_id | update_time | 276078 |<br />| _asin | | | |<br />+--------------------------------+--------------------------------+---------------+---------------+<br />| t_amz_sales_and_traffic_report | PRIMARY | id | 260823952 |<br />| _asin | | | |<br />+--------------------------------+--------------------------------+---------------+---------------+<br />| t_amz_sales_and_traffic_report | uk_report_date_source_id_msku | source_id | 3053827 |<br />| _asin | | | |<br />+--------------------------------+--------------------------------+---------------+---------------+<br />| t_amz_sales_and_traffic_report | uk_source_id_msku | source_id | 607146 |<br />| _asin | | | |<br />+--------------------------------+--------------------------------+---------------+---------------+<br />
    188+ </tr></tbody></table><br />
    189+ 额外建议:<br />索引建议:<br />建议添加索引:ALTER TABLE t_amz_sales_and_traffic_report_asin ADD INDEX idx_id_source_id_update_time(id,source_id,update_time);<br />【t_amz_sales_and_traffic_report_asin】表 【id,source_id,update_time】字段,索引分析:<br />+--------------------------------+--------------------------------+---------------+---------------+<br />| TABLE_NAME | INDEX_NAME | COLUMN_NAME | CARDINALITY |<br />+================================+================================+===============+===============+<br />| t_amz_sales_and_traffic_report | idx_report_date_child_asin_sou | source_id | 262883712 |<br />| _asin | rce_id | | |<br />+--------------------------------+--------------------------------+---------------+---------------+<br />| t_amz_sales_and_traffic_report | idx_sourceid_updatetime | source_id | 447185 |<br />| _asin | | | |<br />+--------------------------------+--------------------------------+---------------+---------------+<br />| t_amz_sales_and_traffic_report | idx_sourceid_updatetime | update_time | 1255422 |<br />| _asin | | | |<br />+--------------------------------+--------------------------------+---------------+---------------+<br />| t_amz_sales_and_traffic_report | idx_update_time_source_id | source_id | 1188044 |<br />| _asin | | | |<br />+--------------------------------+--------------------------------+---------------+---------------+<br />| t_amz_sales_and_traffic_report | idx_update_time_source_id | update_time | 276078 |<br />| _asin | | | |<br />+--------------------------------+--------------------------------+---------------+---------------+<br />| t_amz_sales_and_traffic_report | PRIMARY | id | 260823952 |<br />| _asin | | | |<br />+--------------------------------+--------------------------------+---------------+---------------+<br />| t_amz_sales_and_traffic_report | uk_report_date_source_id_msku | source_id | 3053827 |<br />| _asin | | | |<br />+--------------------------------+--------------------------------+---------------+---------------+<br />| t_amz_sales_and_traffic_report | uk_source_id_msku | source_id | 607146 |<br />| _asin | | | |<br />+--------------------------------+--------------------------------+---------------+---------------+<br />
  5. 2025-08-06 16:37:52, 由 陈莉珍 解决,方案为 非BUG-纯属误判 。
    修改了 解决方案,旧值为 "",新值为 "feibug"。
    修改了 解决日期,旧值为 "",新值为 "2025-08-06 16:37:40"。
    修改了 Bug状态 ,旧值为 "active",新值为 "resolved"。
    修改了 是否确认,旧值为 "0",新值为 "1"。
    修改了 解决者 ,旧值为 "",新值为 "chenlizhen"。
  6. 2025-08-06 16:37:55, 由 陈莉珍 关闭。
    修改了 Bug状态 ,旧值为 "resolved",新值为 "closed"。
    修改了 指派给 ,旧值为 "chenlizhen",新值为 "closed"。
    修改了 由谁关闭,旧值为 "",新值为 "chenlizhen"。
    修改了 关闭日期,旧值为 "",新值为 "2025-08-06 16:37:55"。
所属项目 智能中心-需求池
所属模块 虎鲸系统(有品)
所属计划
所属迭代
Bug类型
严重程度 一般
优先级 P2
Bug状态 已关闭
业务部门 总经办
影响功能
开发责任人 覃光贤
测试责任人 覃光贤
解决时效 0
激活次数 0
激活日期
是否确认 是
当前指派 Closed 于 2025-08-06 16:37:55
截止日期 0000-00-00
上线时间 2025-08-06 13:45:00
上线时效 1.06
操作系统
浏览器
关键词
抄送给
所属迭代
相关需求
相关任务
由谁创建 陈莉珍 于 2025-08-06 12:41:37
影响环境 生产环境-业务反馈
由谁解决 陈莉珍 于 2025-08-06 16:37:40
解决版本
解决方案 非BUG-纯属误判
由谁关闭 陈莉珍 于 2025-08-06 16:37:55
最后修改 陈莉珍 于 2025-08-06 16:37:55
相关Bug