重现步骤

反馈人:李冠、袁慧斌、王凯


问题1:

严重级别:严重
所属项目:OZON
问题原因:慢SQL,并发高,把数据库CPU打满,严重影响策略库其它业务正常运行,SQL为:(
SELECT id,source_id,source_name,strategy_id,queue_id,sku,pf_listing_id,source_sku,title,title_id,pool_id,stock,calculation_formula_id,sale_price,country_code,currency,category_id,category_name,result_task,retry_status,status,fail_total,fail_msg,create_by,update_by,update_time,create_time,is_deleted,remark FROM t_strategy_execute_queue_evaluate_ozon
WHERE (result_task = 2743158115 AND status = 6))

解决方案:建议创建索引idx_result_task_status(result_task,status)


问题2:


数据库:zhcxkj-center-product
查询时间:12.1804
执行次数: 103
扫描行数:7024.89
发送行数:5434.26
指纹SQL: SELECT id , customer_id , sku , title_source , status , title_name , language , create_log , user_log , title_repetition_value , remark , user_time , create_time , update_time , is_deleted , title_md5 , site_code , prompt_type , category1_id , title_source_id FROM ? WHERE ( sku IN ( ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? ) AND status = ? AND is_deleted = ? ) ;
真实SQL:SELECT id,customer_id,sku,title_source,status,title_name,language,create_log,user_log,title_repetition_value,remark,user_time,create_time,update_time,is_deleted,title_md5,site_code,prompt_type,category1_id,title_source_id FROM t_product_sku_title_ozon WHERE (sku IN (3636043,20115231,9917258,17929370,3001828,19773708,9530699,19544810,19073720,17337733,7816027,16893426,18666805,17047235,20827446,17691430,5629714,21498031,18612132,6046898,11707335,13914543,5121493,13970486,4379683,17355013,10776974,18788993,16891042,20712651,18890378,9322160,16339249,5971103,9357040,19440655,17853459,14447785,19661086,10485061,21135948,19517753,14021483,19606169,4640024,17256713,21451464,13759159,4386188,8385048,4301881,20488072,18123147,12839831,17293202,10066889,14472480,18739886,6053123,13683516,4983256,14720559,17705535,7230108,15475979,11905205,17330389,4670102,11648538,15041159,6139934,17216145,16864143,20700507,10028040,17391428,10764691,16837908,6394534,14431907,18845225,17507232,14424098,7951583,16273785,7847350,17493305,20159778,4901821,19257040,21310129,21151911,19062338,19085699,6598298,20096125,20440624,4813367,11798691,14733955,11420621,6859664,20357533,21031783,17227227,9580721,21115200,19434825,10791899,9097197,11703784,11785861,13965432,18048321,20568586,15835327,21456062,15852807,18631265,13403638,12843276,8168964,9354866,9527732,6729500,19588148,17698971,4524455,12613069,18792320,14975913,20091416,10056369,7425545,19455322,19010518,17911497,21404812,19168231,15862517,18994070,20306837,16187497,21001972,8334160,18631587,21529651,5001226,20455955,11028914,10623920,15777335,13791419,19408387,6299392,6493500,8761953,19138060,6455359,14470408,9446440,16199638,3623462,3195916,14770109,14803043,11642560,15667651,13996094,19945305,17591331,10036589,7352233,13396763,19119850,8049415,17581321,21419229,18727903,19625091,14352679,18941264,20999002,21165736,18902732,11582030,15445438,6810304,6049100,6678202,13453393,12029737,3884062,3336911,9457983,6714594,14082324,20811801,19153733,18858299) AND status = 0 AND is_deleted = 0);
无人工修改
AISQL修改建议:SELECT id, customer_id, sku, title_source, status, title_name, language, create_log, user_log, title_repetition_value, remark, user_time, create_time, update_time, is_deleted, title_md5, site_code, prompt_type, category1_id, title_source_id
FROM t_product_sku_title_ozon
WHERE sku IN (3636043,20115231,9917258,17929370,3001828,19773708,9530699,19544810,19073720,17337733,7816027,16893426,18666805,17047235,20827446,17691430,5629714,21498031,18612132,6046898,11707335,13914543,5121493,13970486,4379683,17355013,10776974,18788993,16891042,20712651,18890378,9322160,16339249,5971103,9357040,19440655,17853459,14447785,19661086,10485061,21135948,19517753,14021483,19606169,4640024,17256713,21451464,13759159,4386188,8385048,4301881,20488072,18123147,12839831,17293202,10066889,14472480,18739886,6053123,13683516,4983256,14720559,17705535,7230108,15475979,11905205,17330389,4670102,11648538,15041159,6139934,17216145,16864143,20700507,10028040,17391428,10764691,16837908,6394534,14431907,18845225,17507232,14424098,7951583,16273785,7847350,17493305,20159778,4901821,19257040,21310129,21151911,19062338,19085699,6598298,20096125,20440624,4813367,11798691,14733955,11420621,6859664,20357533,21031783,17227227,9580721,21115200,19434825,10791899,9097197,11703784,11785861,13965432,18048321,20568586,15835327,21456062,15852807,18631265,13403638,12843276,8168964,9354866,9527732,6729500,19588148,17698971,4524455,12613069,18792320,14975913,20091416,10056369,7425545,19455322,19010518,17911497,21404812,19168231,15862517,18994070,20306837,16187497,21001972,8334160,18631587,21529651,5001226,20455955,11028914,10623920,15777335,13791419,19408387,6299392,6493500,8761953,19138060,6455359,14470408,9446440,16199638,3623462,3195916,14770109,14803043,11642560,15667651,13996094,19945305,17591331,10036589,7352233,13396763,19119850,8049415,17581321,21419229,18727903,19625091,14352679,18941264,20999002,21165736,18902732,11582030,15445438,6810304,6049100,6678202,13453393,12029737,3884062,3336911,9457983,6714594,14082324,20811801,19153733,18858299)
AND status = 0
AND is_deleted = 0;
优化建议:
1. 确保在sku字段上有索引(复合索引更好)
2. 如果status和is_deleted字段选择性高,可以考虑创建复合索引(sku, status, is_deleted)
3. 根据实际使用场景,考虑是否添加其他字段到复合索引中
explain表:

id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t_product_sku_title_ozon None range idx_sku_status_title_source_site_code,idx_status_createtime_titlesourceid idx_sku_status_title_source_site_code 1025 None 4600 10 Using index condition; Using where

额外建议:
索引建议:
取出表 【t_product_sku_title_ozon】 where条件字段 【status】 100000 条记录,重复的数据有:【57524】 条,没有必要为该字段创建索引。
取出表 【t_product_sku_title_ozon】 where条件字段 【is_deleted】 100000 条记录,重复的数据有:【78124】 条,没有必要为该字段创建索引。
→ 【t_product_sku_title_ozon】表 【sku】字段,索引已经存在,无需添加任何索引。
【t_product_sku_title_ozon】表 【sku】字段,索引分析:
+--------------------------+--------------------------------+---------------+---------------+
| TABLE_NAME | INDEX_NAME | COLUMN_NAME | CARDINALITY |
+==========================+================================+===============+===============+
| t_product_sku_title_ozon | idx_sku_status_title_source_si | sku | 812718 |
| | te_code | | |

+--------------------------+--------------------------------+---------------+---------------+


问题3:

数据库:zhcxkj-center-warehouse
查询时间:27.7234
执行次数: 288
扫描行数:2507090
发送行数:617.184
指纹SQL: SELECT b . order_code , a . warehouse_id , b . id AS order_list_id , b . sku , b . customer_id , ( b . product_num + IFNULL ( b . product_num_update , ? ) ) product_num , b . pending_move_number - IFNULL ( f . sumNumber , ? ) lock_num , d . order_source_type , a . amazon_shipment_id , IFNULL ( e . order_build_type , ? ) order_build_type , IFNULL ( e . is_sta_com_order , ? ) is_sta_com_order , IFNULL ( e . interface_type , ? ) interface_type , ? as task_type , ? as taskStatus , b . pending_move_number , IFNULL ( f . sumNumber , ? ) sumNumber FROM ? a JOIN t_stk_order_list b ON a . order_code = b . order_code AND a . customer_id = b . customer_id JOIN rb_order_source d ON a . order_source_id = d . id AND a . customer_id = d . customer_id LEFT JOIN ( SELECT a . customer_id , a . origin_order_code , b . order_list_id , SUM ( CASE WHEN a . task_status < ? then b . sku_number else IFNULL ( b . moved_number , ? ) + IFNULL ( b . abnormal_number , ? ) end ) sumNumber FROM ? a join t_stk_moving_task_detail b on b . moving_task_id = a . id and b . customer_id = a . customer_id WHERE task_type = ? AND task_status < ? GROUP BY a . customer_id , a . origin_order_code , b . order_list_id ) f on f . origin_order_code = a . order_code and f . order_list_id = b . id AND f . customer_id = a . customer_id LEFT JOIN t_stk_order_info_beikuexpand e ON a . order_code = e . order_code AND a . customer_id = e . customer_id WHERE a . add_time >= DATE_ADD ( CURRENT_TIMESTAMP , INTERVAL ? MONTH ) AND a . is_stock_order = ? and b . pending_move_number > ? AND b . pending_move_number - IFNULL ( f . sumNumber , ? ) > ? ;
真实SQL:SELECT b.order_code, a.warehouse_id, b.id AS order_list_id, b.sku, b.customer_id, (b.product_num + IFNULL(b.product_num_update,0)) product_num, b.pending_move_number- IFNULL(f.sumNumber, 0) lock_num, d.order_source_type, a.amazon_shipment_id, IFNULL(e.order_build_type, -1) order_build_type, IFNULL(e.is_sta_com_order, 0) is_sta_com_order, IFNULL(e.interface_type, 0) interface_type, 3 as task_type, 0 as taskStatus, b.pending_move_number, IFNULL(f.sumNumber, 0) sumNumber FROM t_stk_order_info a JOIN t_stk_order_list b ON a.order_code = b.order_code AND a.customer_id = b.customer_id JOIN rb_order_source d ON a.order_source_id = d.id AND a.customer_id = d.customer_id LEFT JOIN ( SELECT a.customer_id,a.origin_order_code,b.order_list_id, SUM(CASE WHEN a.task_status < 4 then b.sku_number else IFNULL(b.moved_number,0)+IFNULL(b.abnormal_number,0)end) sumNumber from t_stk_moving_task a join t_stk_moving_task_detail b on b.moving_task_id=a.id and b.customer_id=a.customer_id WHERE task_type=3 AND task_status < 5 GROUP BY a.customer_id,a.origin_order_code,b.order_list_id )f on f.origin_order_code=a.order_code and f.order_list_id=b.id AND f.customer_id=a.customer_id LEFT JOIN t_stk_order_info_beikuexpand e ON a.order_code = e.order_code AND a.customer_id = e.customer_id WHERE a.add_time >= DATE_ADD(CURRENT_TIMESTAMP,INTERVAL -12 MONTH) AND a.is_stock_order = 1 and b.pending_move_number>0 AND b.pending_move_number- IFNULL(f.sumNumber, 0) > 0;
王凯,人工修改过
AISQL修改建议:扫描行数二百多万,未利用好索引
explain表:
额外建议:
索引建议:


历史记录  
  1. 2025-08-25 09:40:46, 由 陈莉珍 创建。
  2. 2025-08-25 09:43:21, 由 陈莉珍 编辑。
    修改了 所属模块,旧值为 "0",新值为 "1953"。
    修改了 业务部门,旧值为 "0",新值为 "2"。
    修改了 解决时效,旧值为 "0",新值为 "-1"。
    修改了 重现步骤,区别为:
    001- 反馈人:李冠
    001+ 反馈人:李冠、袁慧斌
    002- 严重级别:严重
    002+
    003- 所属项目:OZON
    003+ 问题1:
    004- 问题原因:慢SQL,并发高,把数据库CPU打满,严重影响策略库其它业务正常运行,SQL为:(
    004+ 严重级别:严重
    005- SELECT id,source_id,source_name,strategy_id,queue_id,sku,pf_listing_id,source_sku,title,title_id,pool_id,stock,calculation_formula_id,sale_price,country_code,currency,category_id,category_name,result_task,retry_status,status,fail_total,fail_msg,create_by,update_by,update_time,create_time,is_deleted,remark FROM t_strategy_execute_queue_evaluate_ozon
    005+ 所属项目:OZON 问题原因:慢SQL,并发高,把数据库CPU打满,严重影响策略库其它业务正常运行,SQL为:( SELECT id,source_id,source_name,strategy_id,queue_id,sku,pf_listing_id,source_sku,title,title_id,pool_id,stock,calculation_formula_id,sale_price,country_code,currency,category_id,category_name,result_task,retry_status,status,fail_total,fail_msg,create_by,update_by,update_time,create_time,is_deleted,remark FROM t_strategy_execute_queue_evaluate_ozon WHERE (result_task = 2743158115 AND status = 6))解决方案:建议创建索引idx_result_task_status(result_task,status)
    006- WHERE (result_task = 2743158115 AND status = 6))
    006+
    007- 解决方案:建议创建索引idx_result_task_status(result_task,status)
    007+ 问题2:
    008+ 数据库:zhcxkj-center-product查询时间:12.1804执行次数: 103扫描行数:7024.89发送行数:5434.26指纹SQL:
    009+ SELECT id , customer_id , sku , title_source , status , title_name ,
    010+ language , create_log , user_log , title_repetition_value , remark ,
    011+ user_time , create_time , update_time , is_deleted , title_md5 ,
    012+ site_code , prompt_type , category1_id , title_source_id FROM ? WHERE (
    013+ sku IN ( ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? ,
    014+ ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? ,
    015+ ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? ,
    016+ ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? ,
    017+ ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? ,
    018+ ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? ,
    019+ ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? ,
    020+ ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? ,
    021+ ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? ,
    022+ ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? ,
    023+ ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? ,
    024+ ? , ? , ? , ? ) AND status = ? AND is_deleted = ? ) ;真实SQL:SELECT
    025+ id,customer_id,sku,title_source,status,title_name,language,create_log,user_log,title_repetition_value,remark,user_time,create_time,update_time,is_deleted,title_md5,site_code,prompt_type,category1_id,title_source_id
    026+ FROM t_product_sku_title_ozon WHERE (sku IN
    027+ (3636043,20115231,9917258,17929370,3001828,19773708,9530699,19544810,19073720,17337733,7816027,16893426,18666805,17047235,20827446,17691430,5629714,21498031,18612132,6046898,11707335,13914543,5121493,13970486,4379683,17355013,10776974,18788993,16891042,20712651,18890378,9322160,16339249,5971103,9357040,19440655,17853459,14447785,19661086,10485061,21135948,19517753,14021483,19606169,4640024,17256713,21451464,13759159,4386188,8385048,4301881,20488072,18123147,12839831,17293202,10066889,14472480,18739886,6053123,13683516,4983256,14720559,17705535,7230108,15475979,11905205,17330389,4670102,11648538,15041159,6139934,17216145,16864143,20700507,10028040,17391428,10764691,16837908,6394534,14431907,18845225,17507232,14424098,7951583,16273785,7847350,17493305,20159778,4901821,19257040,21310129,21151911,19062338,19085699,6598298,20096125,20440624,4813367,11798691,14733955,11420621,6859664,20357533,21031783,17227227,9580721,21115200,19434825,10791899,9097197,11703784,11785861,13965432,18048321,20568586,15835327,21456062,15852807,18631265,13403638,12843276,8168964,9354866,9527732,6729500,19588148,17698971,4524455,12613069,18792320,14975913,20091416,10056369,7425545,19455322,19010518,17911497,21404812,19168231,15862517,18994070,20306837,16187497,21001972,8334160,18631587,21529651,5001226,20455955,11028914,10623920,15777335,13791419,19408387,6299392,6493500,8761953,19138060,6455359,14470408,9446440,16199638,3623462,3195916,14770109,14803043,11642560,15667651,13996094,19945305,17591331,10036589,7352233,13396763,19119850,8049415,17581321,21419229,18727903,19625091,14352679,18941264,20999002,21165736,18902732,11582030,15445438,6810304,6049100,6678202,13453393,12029737,3884062,3336911,9457983,6714594,14082324,20811801,19153733,18858299)
    028+ AND status = 0 AND is_deleted = 0);无人工修改AISQL修改建议:SELECT id,
    029+ customer_id, sku, title_source, status, title_name, language,
    030+ create_log, user_log, title_repetition_value, remark, user_time,
    031+ create_time, update_time, is_deleted, title_md5, site_code, prompt_type,
    032+ category1_id, title_source_id FROM t_product_sku_title_ozon WHERE
    033+ sku IN
    034+ (3636043,20115231,9917258,17929370,3001828,19773708,9530699,19544810,19073720,17337733,7816027,16893426,18666805,17047235,20827446,17691430,5629714,21498031,18612132,6046898,11707335,13914543,5121493,13970486,4379683,17355013,10776974,18788993,16891042,20712651,18890378,9322160,16339249,5971103,9357040,19440655,17853459,14447785,19661086,10485061,21135948,19517753,14021483,19606169,4640024,17256713,21451464,13759159,4386188,8385048,4301881,20488072,18123147,12839831,17293202,10066889,14472480,18739886,6053123,13683516,4983256,14720559,17705535,7230108,15475979,11905205,17330389,4670102,11648538,15041159,6139934,17216145,16864143,20700507,10028040,17391428,10764691,16837908,6394534,14431907,18845225,17507232,14424098,7951583,16273785,7847350,17493305,20159778,4901821,19257040,21310129,21151911,19062338,19085699,6598298,20096125,20440624,4813367,11798691,14733955,11420621,6859664,20357533,21031783,17227227,9580721,21115200,19434825,10791899,9097197,11703784,11785861,13965432,18048321,20568586,15835327,21456062,15852807,18631265,13403638,12843276,8168964,9354866,9527732,6729500,19588148,17698971,4524455,12613069,18792320,14975913,20091416,10056369,7425545,19455322,19010518,17911497,21404812,19168231,15862517,18994070,20306837,16187497,21001972,8334160,18631587,21529651,5001226,20455955,11028914,10623920,15777335,13791419,19408387,6299392,6493500,8761953,19138060,6455359,14470408,9446440,16199638,3623462,3195916,14770109,14803043,11642560,15667651,13996094,19945305,17591331,10036589,7352233,13396763,19119850,8049415,17581321,21419229,18727903,19625091,14352679,18941264,20999002,21165736,18902732,11582030,15445438,6810304,6049100,6678202,13453393,12029737,3884062,3336911,9457983,6714594,14082324,20811801,19153733,18858299) AND status = 0 AND is_deleted = 0;优化建议:1. 确保在sku字段上有索引(复合索引更好)2. 如果status和is_deleted字段选择性高,可以考虑创建复合索引(sku, status, is_deleted)3. 根据实际使用场景,考虑是否添加其他字段到复合索引中explain表:id
    035+ select_type
    036+ table
    037+ partitions
    038+ type
    039+ possible_keys
    040+ key
    041+ key_len
    042+ ref
    043+ rows
    044+ filtered
    045+ Extra
    046+ 1
    047+ SIMPLE
    048+ t_product_sku_title_ozon
    049+ None
    050+ range
    051+ idx_sku_status_title_source_site_code,idx_status_createtime_titlesourceid
    052+ idx_sku_status_title_source_site_code
    053+ 1025
    054+ None
    055+ 4600
    056+ 10
    057+ Using index condition; Using where
    058+
    059+ 额外建议:索引建议:取出表 【t_product_sku_title_ozon】 where条件字段 【status】 100000 条记录,重复的数据有:【57524】 条,没有必要为该字段创建索引。取出表 【t_product_sku_title_ozon】 where条件字段 【is_deleted】 100000 条记录,重复的数据有:【78124】 条,没有必要为该字段创建索引。→ 【t_product_sku_title_ozon】表 【sku】字段,索引已经存在,无需添加任何索引。【t_product_sku_title_ozon】表 【sku】字段,索引分析:+--------------------------+--------------------------------+---------------+---------------+| TABLE_NAME | INDEX_NAME | COLUMN_NAME | CARDINALITY |+==========================+================================+===============+===============+| t_product_sku_title_ozon | idx_sku_status_title_source_si | sku | 812718 || | te_code | | |+--------------------------+--------------------------------+---------------+---------------+
    001- 反馈人:李冠<br />
    001+ <p>反馈人:李冠、袁慧斌</p>
    002- 严重级别:严重<br />
    002+ <p><br /></p>
    003- 所属项目:OZON<br />
    003+ <p>问题1:</p>
    004- 问题原因:慢SQL,并发高,把数据库CPU打满,严重影响策略库其它业务正常运行,SQL为:(<br />
    004+ 严重级别:严重<br />
    005- SELECT id,source_id,source_name,strategy_id,queue_id,sku,pf_listing_id,source_sku,title,title_id,pool_id,stock,calculation_formula_id,sale_price,country_code,currency,category_id,category_name,result_task,retry_status,status,fail_total,fail_msg,create_by,update_by,update_time,create_time,is_deleted,remark FROM t_strategy_execute_queue_evaluate_ozon <br />
    005+ 所属项目:OZON<br /> 问题原因:慢SQL,并发高,把数据库CPU打满,严重影响策略库其它业务正常运行,SQL为:(<br /> SELECT id,source_id,source_name,strategy_id,queue_id,sku,pf_listing_id,source_sku,title,title_id,pool_id,stock,calculation_formula_id,sale_price,country_code,currency,category_id,category_name,result_task,retry_status,status,fail_total,fail_msg,create_by,update_by,update_time,create_time,is_deleted,remark FROM t_strategy_execute_queue_evaluate_ozon <br /> WHERE (result_task = 2743158115 AND status = 6))<br /><p>解决方案:建议创建索引idx_result_task_status(result_task,status)</p>
    006- WHERE (result_task = 2743158115 AND status = 6))<br />
    006+ <p><br /></p>
    007- 解决方案:建议创建索引idx_result_task_status(result_task,status)
    007+ <p>问题2:</p>
    008+ <p><br />数据库:zhcxkj-center-product<br />查询时间:12.1804<br />执行次数: 103<br />扫描行数:7024.89<br />发送行数:5434.26<br />指纹SQL:
    009+ SELECT id , customer_id , sku , title_source , status , title_name ,
    010+ language , create_log , user_log , title_repetition_value , remark ,
    011+ user_time , create_time , update_time , is_deleted , title_md5 ,
    012+ site_code , prompt_type , category1_id , title_source_id FROM ? WHERE (
    013+ sku IN ( ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? ,
    014+ ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? ,
    015+ ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? ,
    016+ ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? ,
    017+ ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? ,
    018+ ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? ,
    019+ ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? ,
    020+ ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? ,
    021+ ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? ,
    022+ ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? ,
    023+ ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? ,
    024+ ? , ? , ? , ? ) AND status = ? AND is_deleted = ? ) ;<br />真实SQL:SELECT
    025+ id,customer_id,sku,title_source,status,title_name,language,create_log,user_log,title_repetition_value,remark,user_time,create_time,update_time,is_deleted,title_md5,site_code,prompt_type,category1_id,title_source_id
    026+ FROM t_product_sku_title_ozon WHERE (sku IN
    027+ (3636043,20115231,9917258,17929370,3001828,19773708,9530699,19544810,19073720,17337733,7816027,16893426,18666805,17047235,20827446,17691430,5629714,21498031,18612132,6046898,11707335,13914543,5121493,13970486,4379683,17355013,10776974,18788993,16891042,20712651,18890378,9322160,16339249,5971103,9357040,19440655,17853459,14447785,19661086,10485061,21135948,19517753,14021483,19606169,4640024,17256713,21451464,13759159,4386188,8385048,4301881,20488072,18123147,12839831,17293202,10066889,14472480,18739886,6053123,13683516,4983256,14720559,17705535,7230108,15475979,11905205,17330389,4670102,11648538,15041159,6139934,17216145,16864143,20700507,10028040,17391428,10764691,16837908,6394534,14431907,18845225,17507232,14424098,7951583,16273785,7847350,17493305,20159778,4901821,19257040,21310129,21151911,19062338,19085699,6598298,20096125,20440624,4813367,11798691,14733955,11420621,6859664,20357533,21031783,17227227,9580721,21115200,19434825,10791899,9097197,11703784,11785861,13965432,18048321,20568586,15835327,21456062,15852807,18631265,13403638,12843276,8168964,9354866,9527732,6729500,19588148,17698971,4524455,12613069,18792320,14975913,20091416,10056369,7425545,19455322,19010518,17911497,21404812,19168231,15862517,18994070,20306837,16187497,21001972,8334160,18631587,21529651,5001226,20455955,11028914,10623920,15777335,13791419,19408387,6299392,6493500,8761953,19138060,6455359,14470408,9446440,16199638,3623462,3195916,14770109,14803043,11642560,15667651,13996094,19945305,17591331,10036589,7352233,13396763,19119850,8049415,17581321,21419229,18727903,19625091,14352679,18941264,20999002,21165736,18902732,11582030,15445438,6810304,6049100,6678202,13453393,12029737,3884062,3336911,9457983,6714594,14082324,20811801,19153733,18858299)
    028+ AND status = 0 AND is_deleted = 0);<br />无人工修改<br />AISQL修改建议:SELECT id,
    029+ customer_id, sku, title_source, status, title_name, language,
    030+ create_log, user_log, title_repetition_value, remark, user_time,
    031+ create_time, update_time, is_deleted, title_md5, site_code, prompt_type,
    032+ category1_id, title_source_id <br />FROM t_product_sku_title_ozon <br />WHERE
    033+ sku IN
    034+ (3636043,20115231,9917258,17929370,3001828,19773708,9530699,19544810,19073720,17337733,7816027,16893426,18666805,17047235,20827446,17691430,5629714,21498031,18612132,6046898,11707335,13914543,5121493,13970486,4379683,17355013,10776974,18788993,16891042,20712651,18890378,9322160,16339249,5971103,9357040,19440655,17853459,14447785,19661086,10485061,21135948,19517753,14021483,19606169,4640024,17256713,21451464,13759159,4386188,8385048,4301881,20488072,18123147,12839831,17293202,10066889,14472480,18739886,6053123,13683516,4983256,14720559,17705535,7230108,15475979,11905205,17330389,4670102,11648538,15041159,6139934,17216145,16864143,20700507,10028040,17391428,10764691,16837908,6394534,14431907,18845225,17507232,14424098,7951583,16273785,7847350,17493305,20159778,4901821,19257040,21310129,21151911,19062338,19085699,6598298,20096125,20440624,4813367,11798691,14733955,11420621,6859664,20357533,21031783,17227227,9580721,21115200,19434825,10791899,9097197,11703784,11785861,13965432,18048321,20568586,15835327,21456062,15852807,18631265,13403638,12843276,8168964,9354866,9527732,6729500,19588148,17698971,4524455,12613069,18792320,14975913,20091416,10056369,7425545,19455322,19010518,17911497,21404812,19168231,15862517,18994070,20306837,16187497,21001972,8334160,18631587,21529651,5001226,20455955,11028914,10623920,15777335,13791419,19408387,6299392,6493500,8761953,19138060,6455359,14470408,9446440,16199638,3623462,3195916,14770109,14803043,11642560,15667651,13996094,19945305,17591331,10036589,7352233,13396763,19119850,8049415,17581321,21419229,18727903,19625091,14352679,18941264,20999002,21165736,18902732,11582030,15445438,6810304,6049100,6678202,13453393,12029737,3884062,3336911,9457983,6714594,14082324,20811801,19153733,18858299) <br />AND status = 0 <br />AND is_deleted = 0;<br />优化建议:<br />1. 确保在sku字段上有索引(复合索引更好)<br />2. 如果status和is_deleted字段选择性高,可以考虑创建复合索引(sku, status, is_deleted)<br />3. 根据实际使用场景,考虑是否添加其他字段到复合索引中<br />explain表:<br /><br /><br /><br /></p><table class="ke-select-col"><tbody><tr><th>id</th>
    035+ <th>select_type</th>
    036+ <th>table</th>
    037+ <th>partitions</th>
    038+ <th>type</th>
    039+ <th>possible_keys</th>
    040+ <th>key</th>
    041+ <th>key_len</th>
    042+ <th>ref</th>
    043+ <th>rows</th>
    044+ <th>filtered</th>
    045+ <th>Extra</th>
    046+ </tr></tbody><tbody><tr><td>1</td>
    047+ <td>SIMPLE</td>
    048+ <td>t_product_sku_title_ozon</td>
    049+ <td>None</td>
    050+ <td>range</td>
    051+ <td>idx_sku_status_title_source_site_code,idx_status_createtime_titlesourceid</td>
    052+ <td>idx_sku_status_title_source_site_code</td>
    053+ <td>1025</td>
    054+ <td>None</td>
    055+ <td>4600</td>
    056+ <td>10</td>
    057+ <td>Using index condition; Using where</td>
    058+ </tr></tbody></table><br />
    059+ 额外建议:<br />索引建议:<br />取出表 【t_product_sku_title_ozon】 where条件字段 【status】 100000 条记录,重复的数据有:【57524】 条,没有必要为该字段创建索引。<br />取出表 【t_product_sku_title_ozon】 where条件字段 【is_deleted】 100000 条记录,重复的数据有:【78124】 条,没有必要为该字段创建索引。<br />→ 【t_product_sku_title_ozon】表 【sku】字段,索引已经存在,无需添加任何索引。<br />【t_product_sku_title_ozon】表 【sku】字段,索引分析:<br />+--------------------------+--------------------------------+---------------+---------------+<br />| TABLE_NAME | INDEX_NAME | COLUMN_NAME | CARDINALITY |<br />+==========================+================================+===============+===============+<br />| t_product_sku_title_ozon | idx_sku_status_title_source_si | sku | 812718 |<br />| | te_code | | |<br />+--------------------------+--------------------------------+---------------+---------------+<br /><br />
  3. 2025-08-25 10:05:50, 由 陈莉珍 编辑。
    修改了 解决时效,旧值为 "0",新值为 "-1"。
    修改了 重现步骤,区别为:
    001- 反馈人:李冠、袁慧斌
    001+ 反馈人:李冠、袁慧斌、王凯
    034- (3636043,20115231,9917258,17929370,3001828,19773708,9530699,19544810,19073720,17337733,7816027,16893426,18666805,17047235,20827446,17691430,5629714,21498031,18612132,6046898,11707335,13914543,5121493,13970486,4379683,17355013,10776974,18788993,16891042,20712651,18890378,9322160,16339249,5971103,9357040,19440655,17853459,14447785,19661086,10485061,21135948,19517753,14021483,19606169,4640024,17256713,21451464,13759159,4386188,8385048,4301881,20488072,18123147,12839831,17293202,10066889,14472480,18739886,6053123,13683516,4983256,14720559,17705535,7230108,15475979,11905205,17330389,4670102,11648538,15041159,6139934,17216145,16864143,20700507,10028040,17391428,10764691,16837908,6394534,14431907,18845225,17507232,14424098,7951583,16273785,7847350,17493305,20159778,4901821,19257040,21310129,21151911,19062338,19085699,6598298,20096125,20440624,4813367,11798691,14733955,11420621,6859664,20357533,21031783,17227227,9580721,21115200,19434825,10791899,9097197,11703784,11785861,13965432,18048321,20568586,15835327,21456062,15852807,18631265,13403638,12843276,8168964,9354866,9527732,6729500,19588148,17698971,4524455,12613069,18792320,14975913,20091416,10056369,7425545,19455322,19010518,17911497,21404812,19168231,15862517,18994070,20306837,16187497,21001972,8334160,18631587,21529651,5001226,20455955,11028914,10623920,15777335,13791419,19408387,6299392,6493500,8761953,19138060,6455359,14470408,9446440,16199638,3623462,3195916,14770109,14803043,11642560,15667651,13996094,19945305,17591331,10036589,7352233,13396763,19119850,8049415,17581321,21419229,18727903,19625091,14352679,18941264,20999002,21165736,18902732,11582030,15445438,6810304,6049100,6678202,13453393,12029737,3884062,3336911,9457983,6714594,14082324,20811801,19153733,18858299) AND status = 0 AND is_deleted = 0;优化建议:1. 确保在sku字段上有索引(复合索引更好)2. 如果status和is_deleted字段选择性高,可以考虑创建复合索引(sku, status, is_deleted)3. 根据实际使用场景,考虑是否添加其他字段到复合索引中explain表:id
    034+ (3636043,20115231,9917258,17929370,3001828,19773708,9530699,19544810,19073720,17337733,7816027,16893426,18666805,17047235,20827446,17691430,5629714,21498031,18612132,6046898,11707335,13914543,5121493,13970486,4379683,17355013,10776974,18788993,16891042,20712651,18890378,9322160,16339249,5971103,9357040,19440655,17853459,14447785,19661086,10485061,21135948,19517753,14021483,19606169,4640024,17256713,21451464,13759159,4386188,8385048,4301881,20488072,18123147,12839831,17293202,10066889,14472480,18739886,6053123,13683516,4983256,14720559,17705535,7230108,15475979,11905205,17330389,4670102,11648538,15041159,6139934,17216145,16864143,20700507,10028040,17391428,10764691,16837908,6394534,14431907,18845225,17507232,14424098,7951583,16273785,7847350,17493305,20159778,4901821,19257040,21310129,21151911,19062338,19085699,6598298,20096125,20440624,4813367,11798691,14733955,11420621,6859664,20357533,21031783,17227227,9580721,21115200,19434825,10791899,9097197,11703784,11785861,13965432,18048321,20568586,15835327,21456062,15852807,18631265,13403638,12843276,8168964,9354866,9527732,6729500,19588148,17698971,4524455,12613069,18792320,14975913,20091416,10056369,7425545,19455322,19010518,17911497,21404812,19168231,15862517,18994070,20306837,16187497,21001972,8334160,18631587,21529651,5001226,20455955,11028914,10623920,15777335,13791419,19408387,6299392,6493500,8761953,19138060,6455359,14470408,9446440,16199638,3623462,3195916,14770109,14803043,11642560,15667651,13996094,19945305,17591331,10036589,7352233,13396763,19119850,8049415,17581321,21419229,18727903,19625091,14352679,18941264,20999002,21165736,18902732,11582030,15445438,6810304,6049100,6678202,13453393,12029737,3884062,3336911,9457983,6714594,14082324,20811801,19153733,18858299) AND status = 0 AND is_deleted = 0;优化建议:1. 确保在sku字段上有索引(复合索引更好)2. 如果status和is_deleted字段选择性高,可以考虑创建复合索引(sku, status, is_deleted)3. 根据实际使用场景,考虑是否添加其他字段到复合索引中explain表:
    035- select_type
    035+ id
    036- table
    036+ select_type
    037- partitions
    037+ table
    038- type
    038+ partitions
    039- possible_keys
    039+ type
    040- key
    040+ possible_keys
    041- key_len
    041+ key
    042- ref
    042+ key_len
    043- rows
    043+ ref
    044- filtered
    044+ rows
    045- Extra
    045+ filtered
    046- 1
    046+ Extra
    047- SIMPLE
    047+ 1
    048- t_product_sku_title_ozon
    048+ SIMPLE
    049- None
    049+ t_product_sku_title_ozon
    050- range
    050+ None
    051- idx_sku_status_title_source_site_code,idx_status_createtime_titlesourceid
    051+ range
    052- idx_sku_status_title_source_site_code
    052+ idx_sku_status_title_source_site_code,idx_status_createtime_titlesourceid
    053- 1025
    053+ idx_sku_status_title_source_site_code
    054- None
    054+ 1025
    055- 4600
    055+ None
    056- 10
    056+ 4600
    057- Using index condition; Using where
    057+ 10
    058-
    058+ Using index condition; Using where
    059- 额外建议:索引建议:取出表 【t_product_sku_title_ozon】 where条件字段 【status】 100000 条记录,重复的数据有:【57524】 条,没有必要为该字段创建索引。取出表 【t_product_sku_title_ozon】 where条件字段 【is_deleted】 100000 条记录,重复的数据有:【78124】 条,没有必要为该字段创建索引。→ 【t_product_sku_title_ozon】表 【sku】字段,索引已经存在,无需添加任何索引。【t_product_sku_title_ozon】表 【sku】字段,索引分析:+--------------------------+--------------------------------+---------------+---------------+| TABLE_NAME | INDEX_NAME | COLUMN_NAME | CARDINALITY |+==========================+================================+===============+===============+| t_product_sku_title_ozon | idx_sku_status_title_source_si | sku | 812718 || | te_code | | |+--------------------------+--------------------------------+---------------+---------------+
    059+
    060+ 额外建议:索引建议:取出表 【t_product_sku_title_ozon】 where条件字段 【status】 100000 条记录,重复的数据有:【57524】 条,没有必要为该字段创建索引。取出表 【t_product_sku_title_ozon】 where条件字段 【is_deleted】 100000 条记录,重复的数据有:【78124】 条,没有必要为该字段创建索引。→ 【t_product_sku_title_ozon】表 【sku】字段,索引已经存在,无需添加任何索引。【t_product_sku_title_ozon】表 【sku】字段,索引分析:+--------------------------+--------------------------------+---------------+---------------+| TABLE_NAME | INDEX_NAME | COLUMN_NAME | CARDINALITY |+==========================+================================+===============+===============+| t_product_sku_title_ozon | idx_sku_status_title_source_si | sku | 812718 || | te_code | | |+--------------------------+--------------------------------+---------------+---------------+
    061+
    062+ 问题3:
    063+ 数据库:zhcxkj-center-warehouse查询时间:27.7234执行次数: 288扫描行数:2507090发送行数:617.184指纹SQL:
    064+ SELECT b . order_code , a . warehouse_id , b . id AS order_list_id , b .
    065+ sku , b . customer_id , ( b . product_num + IFNULL ( b .
    066+ product_num_update , ? ) ) product_num , b . pending_move_number -
    067+ IFNULL ( f . sumNumber , ? ) lock_num , d . order_source_type , a .
    068+ amazon_shipment_id , IFNULL ( e . order_build_type , ? )
    069+ order_build_type , IFNULL ( e . is_sta_com_order , ? ) is_sta_com_order ,
    070+ IFNULL ( e . interface_type , ? ) interface_type , ? as task_type , ?
    071+ as taskStatus , b . pending_move_number , IFNULL ( f . sumNumber , ? )
    072+ sumNumber FROM ? a JOIN t_stk_order_list b ON a . order_code = b .
    073+ order_code AND a . customer_id = b . customer_id JOIN rb_order_source d
    074+ ON a . order_source_id = d . id AND a . customer_id = d . customer_id
    075+ LEFT JOIN ( SELECT a . customer_id , a . origin_order_code , b .
    076+ order_list_id , SUM ( CASE WHEN a . task_status &lt; ? then b .
    077+ sku_number else IFNULL ( b . moved_number , ? ) + IFNULL ( b .
    078+ abnormal_number , ? ) end ) sumNumber FROM ? a join
    079+ t_stk_moving_task_detail b on b . moving_task_id = a . id and b .
    080+ customer_id = a . customer_id WHERE task_type = ? AND task_status &lt; ?
    081+ GROUP BY a . customer_id , a . origin_order_code , b . order_list_id ) f
    082+ on f . origin_order_code = a . order_code and f . order_list_id = b .
    083+ id AND f . customer_id = a . customer_id LEFT JOIN
    084+ t_stk_order_info_beikuexpand e ON a . order_code = e . order_code AND a .
    085+ customer_id = e . customer_id WHERE a . add_time &gt;= DATE_ADD (
    086+ CURRENT_TIMESTAMP , INTERVAL ? MONTH ) AND a . is_stock_order = ? and b .
    087+ pending_move_number &gt; ? AND b . pending_move_number - IFNULL ( f .
    088+ sumNumber , ? ) &gt; ? ;真实SQL:SELECT b.order_code,
    089+ a.warehouse_id, b.id AS order_list_id,
    090+ b.sku, b.customer_id, (b.product_num +
    091+ IFNULL(b.product_num_update,0)) product_num,
    092+ b.pending_move_number- IFNULL(f.sumNumber, 0) lock_num,
    093+ d.order_source_type, a.amazon_shipment_id,
    094+ IFNULL(e.order_build_type, -1) order_build_type,
    095+ IFNULL(e.is_sta_com_order, 0) is_sta_com_order,
    096+ IFNULL(e.interface_type, 0) interface_type, 3 as task_type,
    097+ 0 as taskStatus, b.pending_move_number,
    098+ IFNULL(f.sumNumber, 0) sumNumber FROM t_stk_order_info a
    099+ JOIN t_stk_order_list b ON a.order_code = b.order_code AND
    100+ a.customer_id = b.customer_id JOIN rb_order_source d ON
    101+ a.order_source_id = d.id AND a.customer_id = d.customer_id LEFT
    102+ JOIN ( SELECT a.customer_id,a.origin_order_code,b.order_list_id,
    103+ SUM(CASE WHEN a.task_status &lt; 4 then b.sku_number else
    104+ IFNULL(b.moved_number,0)+IFNULL(b.abnormal_number,0)end) sumNumber from
    105+ t_stk_moving_task a join t_stk_moving_task_detail b on
    106+ b.moving_task_id=a.id and b.customer_id=a.customer_id WHERE task_type=3
    107+ AND task_status &lt; 5 GROUP BY
    108+ a.customer_id,a.origin_order_code,b.order_list_id )f on
    109+ f.origin_order_code=a.order_code and f.order_list_id=b.id AND
    110+ f.customer_id=a.customer_id LEFT JOIN t_stk_order_info_beikuexpand e ON
    111+ a.order_code = e.order_code AND a.customer_id = e.customer_id WHERE
    112+ a.add_time &gt;= DATE_ADD(CURRENT_TIMESTAMP,INTERVAL -12 MONTH)
    113+ AND a.is_stock_order = 1 and b.pending_move_number&gt;0
    114+ AND b.pending_move_number- IFNULL(f.sumNumber, 0) &gt; 0;王凯,人工修改过AISQL修改建议:扫描行数二百多万,未利用好索引explain表:额外建议:索引建议:
    115+
    001- <p>反馈人:李冠、袁慧斌</p>
    001+ <p>反馈人:李冠、袁慧斌、王凯</p>
    034- (3636043,20115231,9917258,17929370,3001828,19773708,9530699,19544810,19073720,17337733,7816027,16893426,18666805,17047235,20827446,17691430,5629714,21498031,18612132,6046898,11707335,13914543,5121493,13970486,4379683,17355013,10776974,18788993,16891042,20712651,18890378,9322160,16339249,5971103,9357040,19440655,17853459,14447785,19661086,10485061,21135948,19517753,14021483,19606169,4640024,17256713,21451464,13759159,4386188,8385048,4301881,20488072,18123147,12839831,17293202,10066889,14472480,18739886,6053123,13683516,4983256,14720559,17705535,7230108,15475979,11905205,17330389,4670102,11648538,15041159,6139934,17216145,16864143,20700507,10028040,17391428,10764691,16837908,6394534,14431907,18845225,17507232,14424098,7951583,16273785,7847350,17493305,20159778,4901821,19257040,21310129,21151911,19062338,19085699,6598298,20096125,20440624,4813367,11798691,14733955,11420621,6859664,20357533,21031783,17227227,9580721,21115200,19434825,10791899,9097197,11703784,11785861,13965432,18048321,20568586,15835327,21456062,15852807,18631265,13403638,12843276,8168964,9354866,9527732,6729500,19588148,17698971,4524455,12613069,18792320,14975913,20091416,10056369,7425545,19455322,19010518,17911497,21404812,19168231,15862517,18994070,20306837,16187497,21001972,8334160,18631587,21529651,5001226,20455955,11028914,10623920,15777335,13791419,19408387,6299392,6493500,8761953,19138060,6455359,14470408,9446440,16199638,3623462,3195916,14770109,14803043,11642560,15667651,13996094,19945305,17591331,10036589,7352233,13396763,19119850,8049415,17581321,21419229,18727903,19625091,14352679,18941264,20999002,21165736,18902732,11582030,15445438,6810304,6049100,6678202,13453393,12029737,3884062,3336911,9457983,6714594,14082324,20811801,19153733,18858299) <br />AND status = 0 <br />AND is_deleted = 0;<br />优化建议:<br />1. 确保在sku字段上有索引(复合索引更好)<br />2. 如果status和is_deleted字段选择性高,可以考虑创建复合索引(sku, status, is_deleted)<br />3. 根据实际使用场景,考虑是否添加其他字段到复合索引中<br />explain表:<br /><br /><br /><br /></p><table class="ke-select-col"><tbody><tr><th>id</th>
    034+ (3636043,20115231,9917258,17929370,3001828,19773708,9530699,19544810,19073720,17337733,7816027,16893426,18666805,17047235,20827446,17691430,5629714,21498031,18612132,6046898,11707335,13914543,5121493,13970486,4379683,17355013,10776974,18788993,16891042,20712651,18890378,9322160,16339249,5971103,9357040,19440655,17853459,14447785,19661086,10485061,21135948,19517753,14021483,19606169,4640024,17256713,21451464,13759159,4386188,8385048,4301881,20488072,18123147,12839831,17293202,10066889,14472480,18739886,6053123,13683516,4983256,14720559,17705535,7230108,15475979,11905205,17330389,4670102,11648538,15041159,6139934,17216145,16864143,20700507,10028040,17391428,10764691,16837908,6394534,14431907,18845225,17507232,14424098,7951583,16273785,7847350,17493305,20159778,4901821,19257040,21310129,21151911,19062338,19085699,6598298,20096125,20440624,4813367,11798691,14733955,11420621,6859664,20357533,21031783,17227227,9580721,21115200,19434825,10791899,9097197,11703784,11785861,13965432,18048321,20568586,15835327,21456062,15852807,18631265,13403638,12843276,8168964,9354866,9527732,6729500,19588148,17698971,4524455,12613069,18792320,14975913,20091416,10056369,7425545,19455322,19010518,17911497,21404812,19168231,15862517,18994070,20306837,16187497,21001972,8334160,18631587,21529651,5001226,20455955,11028914,10623920,15777335,13791419,19408387,6299392,6493500,8761953,19138060,6455359,14470408,9446440,16199638,3623462,3195916,14770109,14803043,11642560,15667651,13996094,19945305,17591331,10036589,7352233,13396763,19119850,8049415,17581321,21419229,18727903,19625091,14352679,18941264,20999002,21165736,18902732,11582030,15445438,6810304,6049100,6678202,13453393,12029737,3884062,3336911,9457983,6714594,14082324,20811801,19153733,18858299) <br />AND status = 0 <br />AND is_deleted = 0;<br />优化建议:<br />1. 确保在sku字段上有索引(复合索引更好)<br />2. 如果status和is_deleted字段选择性高,可以考虑创建复合索引(sku, status, is_deleted)<br />3. 根据实际使用场景,考虑是否添加其他字段到复合索引中<br />explain表:<br /><br /></p>
    035- <th>select_type</th>
    035+ <table><tbody><tr><th>id</th>
    036- <th>table</th>
    036+ <th>select_type</th>
    037- <th>partitions</th>
    037+ <th>table</th>
    038- <th>type</th>
    038+ <th>partitions</th>
    039- <th>possible_keys</th>
    039+ <th>type</th>
    040- <th>key</th>
    040+ <th>possible_keys</th>
    041- <th>key_len</th>
    041+ <th>key</th>
    042- <th>ref</th>
    042+ <th>key_len</th>
    043- <th>rows</th>
    043+ <th>ref</th>
    044- <th>filtered</th>
    044+ <th>rows</th>
    045- <th>Extra</th>
    045+ <th>filtered</th>
    046- </tr></tbody><tbody><tr><td>1</td>
    046+ <th>Extra</th>
    047- <td>SIMPLE</td>
    047+ </tr></tbody><tbody><tr><td>1</td>
    048- <td>t_product_sku_title_ozon</td>
    048+ <td>SIMPLE</td>
    049- <td>None</td>
    049+ <td>t_product_sku_title_ozon</td>
    050- <td>range</td>
    050+ <td>None</td>
    051- <td>idx_sku_status_title_source_site_code,idx_status_createtime_titlesourceid</td>
    051+ <td>range</td>
    052- <td>idx_sku_status_title_source_site_code</td>
    052+ <td>idx_sku_status_title_source_site_code,idx_status_createtime_titlesourceid</td>
    053- <td>1025</td>
    053+ <td>idx_sku_status_title_source_site_code</td>
    054- <td>None</td>
    054+ <td>1025</td>
    055- <td>4600</td>
    055+ <td>None</td>
    056- <td>10</td>
    056+ <td>4600</td>
    057- <td>Using index condition; Using where</td>
    057+ <td>10</td>
    058- </tr></tbody></table><br />
    058+ <td>Using index condition; Using where</td>
    059- 额外建议:<br />索引建议:<br />取出表 【t_product_sku_title_ozon】 where条件字段 【status】 100000 条记录,重复的数据有:【57524】 条,没有必要为该字段创建索引。<br />取出表 【t_product_sku_title_ozon】 where条件字段 【is_deleted】 100000 条记录,重复的数据有:【78124】 条,没有必要为该字段创建索引。<br />→ 【t_product_sku_title_ozon】表 【sku】字段,索引已经存在,无需添加任何索引。<br />【t_product_sku_title_ozon】表 【sku】字段,索引分析:<br />+--------------------------+--------------------------------+---------------+---------------+<br />| TABLE_NAME | INDEX_NAME | COLUMN_NAME | CARDINALITY |<br />+==========================+================================+===============+===============+<br />| t_product_sku_title_ozon | idx_sku_status_title_source_si | sku | 812718 |<br />| | te_code | | |<br />+--------------------------+--------------------------------+---------------+---------------+<br /><br />
    059+ </tr></tbody></table><br />
    060+ 额外建议:<br />索引建议:<br />取出表 【t_product_sku_title_ozon】 where条件字段 【status】 100000 条记录,重复的数据有:【57524】 条,没有必要为该字段创建索引。<br />取出表 【t_product_sku_title_ozon】 where条件字段 【is_deleted】 100000 条记录,重复的数据有:【78124】 条,没有必要为该字段创建索引。<br />→ 【t_product_sku_title_ozon】表 【sku】字段,索引已经存在,无需添加任何索引。<br />【t_product_sku_title_ozon】表 【sku】字段,索引分析:<br />+--------------------------+--------------------------------+---------------+---------------+<br />| TABLE_NAME | INDEX_NAME | COLUMN_NAME | CARDINALITY |<br />+==========================+================================+===============+===============+<br />| t_product_sku_title_ozon | idx_sku_status_title_source_si | sku | 812718 |<br />| | te_code | | |<br /><p>+--------------------------+--------------------------------+---------------+---------------+</p>
    061+ <p><br /></p>
    062+ <p>问题3:</p>
    063+ <p>数据库:zhcxkj-center-warehouse<br />查询时间:27.7234<br />执行次数: 288<br />扫描行数:2507090<br />发送行数:617.184<br />指纹SQL:
    064+ SELECT b . order_code , a . warehouse_id , b . id AS order_list_id , b .
    065+ sku , b . customer_id , ( b . product_num + IFNULL ( b .
    066+ product_num_update , ? ) ) product_num , b . pending_move_number -
    067+ IFNULL ( f . sumNumber , ? ) lock_num , d . order_source_type , a .
    068+ amazon_shipment_id , IFNULL ( e . order_build_type , ? )
    069+ order_build_type , IFNULL ( e . is_sta_com_order , ? ) is_sta_com_order ,
    070+ IFNULL ( e . interface_type , ? ) interface_type , ? as task_type , ?
    071+ as taskStatus , b . pending_move_number , IFNULL ( f . sumNumber , ? )
    072+ sumNumber FROM ? a JOIN t_stk_order_list b ON a . order_code = b .
    073+ order_code AND a . customer_id = b . customer_id JOIN rb_order_source d
    074+ ON a . order_source_id = d . id AND a . customer_id = d . customer_id
    075+ LEFT JOIN ( SELECT a . customer_id , a . origin_order_code , b .
    076+ order_list_id , SUM ( CASE WHEN a . task_status &lt; ? then b .
    077+ sku_number else IFNULL ( b . moved_number , ? ) + IFNULL ( b .
    078+ abnormal_number , ? ) end ) sumNumber FROM ? a join
    079+ t_stk_moving_task_detail b on b . moving_task_id = a . id and b .
    080+ customer_id = a . customer_id WHERE task_type = ? AND task_status &lt; ?
    081+ GROUP BY a . customer_id , a . origin_order_code , b . order_list_id ) f
    082+ on f . origin_order_code = a . order_code and f . order_list_id = b .
    083+ id AND f . customer_id = a . customer_id LEFT JOIN
    084+ t_stk_order_info_beikuexpand e ON a . order_code = e . order_code AND a .
    085+ customer_id = e . customer_id WHERE a . add_time &gt;= DATE_ADD (
    086+ CURRENT_TIMESTAMP , INTERVAL ? MONTH ) AND a . is_stock_order = ? and b .
    087+ pending_move_number &gt; ? AND b . pending_move_number - IFNULL ( f .
    088+ sumNumber , ? ) &gt; ? ;<br />真实SQL:SELECT b.order_code,
    089+ a.warehouse_id, b.id AS order_list_id,
    090+ b.sku, b.customer_id, (b.product_num +
    091+ IFNULL(b.product_num_update,0)) product_num,
    092+ b.pending_move_number- IFNULL(f.sumNumber, 0) lock_num,
    093+ d.order_source_type, a.amazon_shipment_id,
    094+ IFNULL(e.order_build_type, -1) order_build_type,
    095+ IFNULL(e.is_sta_com_order, 0) is_sta_com_order,
    096+ IFNULL(e.interface_type, 0) interface_type, 3 as task_type,
    097+ 0 as taskStatus, b.pending_move_number,
    098+ IFNULL(f.sumNumber, 0) sumNumber FROM t_stk_order_info a
    099+ JOIN t_stk_order_list b ON a.order_code = b.order_code AND
    100+ a.customer_id = b.customer_id JOIN rb_order_source d ON
    101+ a.order_source_id = d.id AND a.customer_id = d.customer_id LEFT
    102+ JOIN ( SELECT a.customer_id,a.origin_order_code,b.order_list_id,
    103+ SUM(CASE WHEN a.task_status &lt; 4 then b.sku_number else
    104+ IFNULL(b.moved_number,0)+IFNULL(b.abnormal_number,0)end) sumNumber from
    105+ t_stk_moving_task a join t_stk_moving_task_detail b on
    106+ b.moving_task_id=a.id and b.customer_id=a.customer_id WHERE task_type=3
    107+ AND task_status &lt; 5 GROUP BY
    108+ a.customer_id,a.origin_order_code,b.order_list_id )f on
    109+ f.origin_order_code=a.order_code and f.order_list_id=b.id AND
    110+ f.customer_id=a.customer_id LEFT JOIN t_stk_order_info_beikuexpand e ON
    111+ a.order_code = e.order_code AND a.customer_id = e.customer_id WHERE
    112+ a.add_time &gt;= DATE_ADD(CURRENT_TIMESTAMP,INTERVAL -12 MONTH)
    113+ AND a.is_stock_order = 1 and b.pending_move_number&gt;0
    114+ AND b.pending_move_number- IFNULL(f.sumNumber, 0) &gt; 0;<br />王凯,人工修改过<br />AISQL修改建议:扫描行数二百多万,未利用好索引<br />explain表:<br />额外建议:<br />索引建议:<br /></p>
    115+ <br />
  4. 2025-08-25 10:18:42, 由 蔡俊伟 指派给 周凯。
    修改了 指派给,旧值为 "caijunwei",新值为 "zhoukai"。
  5. 2025-08-25 10:22:23, 由 周凯 解决,方案为 程序BUG 。
    修改了 解决方案,旧值为 "",新值为 "code"。
    修改了 解决日期,旧值为 "",新值为 "2025-08-25 10:22:20"。
    修改了 指派给 ,旧值为 "zhoukai",新值为 "chenlizhen"。
    修改了 Bug状态 ,旧值为 "active",新值为 "resolved"。
    修改了 是否确认,旧值为 "0",新值为 "1"。
    修改了 解决者 ,旧值为 "",新值为 "zhoukai"。
  6. 2025-08-25 14:05:21, 由 陈莉珍 编辑。
    修改了 开发责任人,旧值为 "",新值为 "zhoukai"。
    修改了 测试责任人,旧值为 "",新值为 "zhoukai"。
    修改了 解决时效 ,旧值为 "0",新值为 "0.69"。
    修改了 上线时间 ,旧值为 "0000-00-00 00:00:00",新值为 "2025-08-25 10:25"。
    修改了 上线时效 ,旧值为 "-1",新值为 "0.74"。
    修改了 重现步骤 ,区别为:
    034- (3636043,20115231,9917258,17929370,3001828,19773708,9530699,19544810,19073720,17337733,7816027,16893426,18666805,17047235,20827446,17691430,5629714,21498031,18612132,6046898,11707335,13914543,5121493,13970486,4379683,17355013,10776974,18788993,16891042,20712651,18890378,9322160,16339249,5971103,9357040,19440655,17853459,14447785,19661086,10485061,21135948,19517753,14021483,19606169,4640024,17256713,21451464,13759159,4386188,8385048,4301881,20488072,18123147,12839831,17293202,10066889,14472480,18739886,6053123,13683516,4983256,14720559,17705535,7230108,15475979,11905205,17330389,4670102,11648538,15041159,6139934,17216145,16864143,20700507,10028040,17391428,10764691,16837908,6394534,14431907,18845225,17507232,14424098,7951583,16273785,7847350,17493305,20159778,4901821,19257040,21310129,21151911,19062338,19085699,6598298,20096125,20440624,4813367,11798691,14733955,11420621,6859664,20357533,21031783,17227227,9580721,21115200,19434825,10791899,9097197,11703784,11785861,13965432,18048321,20568586,15835327,21456062,15852807,18631265,13403638,12843276,8168964,9354866,9527732,6729500,19588148,17698971,4524455,12613069,18792320,14975913,20091416,10056369,7425545,19455322,19010518,17911497,21404812,19168231,15862517,18994070,20306837,16187497,21001972,8334160,18631587,21529651,5001226,20455955,11028914,10623920,15777335,13791419,19408387,6299392,6493500,8761953,19138060,6455359,14470408,9446440,16199638,3623462,3195916,14770109,14803043,11642560,15667651,13996094,19945305,17591331,10036589,7352233,13396763,19119850,8049415,17581321,21419229,18727903,19625091,14352679,18941264,20999002,21165736,18902732,11582030,15445438,6810304,6049100,6678202,13453393,12029737,3884062,3336911,9457983,6714594,14082324,20811801,19153733,18858299) AND status = 0 AND is_deleted = 0;优化建议:1. 确保在sku字段上有索引(复合索引更好)2. 如果status和is_deleted字段选择性高,可以考虑创建复合索引(sku, status, is_deleted)3. 根据实际使用场景,考虑是否添加其他字段到复合索引中explain表:
    034+ (3636043,20115231,9917258,17929370,3001828,19773708,9530699,19544810,19073720,17337733,7816027,16893426,18666805,17047235,20827446,17691430,5629714,21498031,18612132,6046898,11707335,13914543,5121493,13970486,4379683,17355013,10776974,18788993,16891042,20712651,18890378,9322160,16339249,5971103,9357040,19440655,17853459,14447785,19661086,10485061,21135948,19517753,14021483,19606169,4640024,17256713,21451464,13759159,4386188,8385048,4301881,20488072,18123147,12839831,17293202,10066889,14472480,18739886,6053123,13683516,4983256,14720559,17705535,7230108,15475979,11905205,17330389,4670102,11648538,15041159,6139934,17216145,16864143,20700507,10028040,17391428,10764691,16837908,6394534,14431907,18845225,17507232,14424098,7951583,16273785,7847350,17493305,20159778,4901821,19257040,21310129,21151911,19062338,19085699,6598298,20096125,20440624,4813367,11798691,14733955,11420621,6859664,20357533,21031783,17227227,9580721,21115200,19434825,10791899,9097197,11703784,11785861,13965432,18048321,20568586,15835327,21456062,15852807,18631265,13403638,12843276,8168964,9354866,9527732,6729500,19588148,17698971,4524455,12613069,18792320,14975913,20091416,10056369,7425545,19455322,19010518,17911497,21404812,19168231,15862517,18994070,20306837,16187497,21001972,8334160,18631587,21529651,5001226,20455955,11028914,10623920,15777335,13791419,19408387,6299392,6493500,8761953,19138060,6455359,14470408,9446440,16199638,3623462,3195916,14770109,14803043,11642560,15667651,13996094,19945305,17591331,10036589,7352233,13396763,19119850,8049415,17581321,21419229,18727903,19625091,14352679,18941264,20999002,21165736,18902732,11582030,15445438,6810304,6049100,6678202,13453393,12029737,3884062,3336911,9457983,6714594,14082324,20811801,19153733,18858299) AND status = 0 AND is_deleted = 0;优化建议:1. 确保在sku字段上有索引(复合索引更好)2. 如果status和is_deleted字段选择性高,可以考虑创建复合索引(sku, status, is_deleted)3. 根据实际使用场景,考虑是否添加其他字段到复合索引中explain表:
    114- AND b.pending_move_number- IFNULL(f.sumNumber, 0) &gt; 0;王凯,人工修改过AISQL修改建议:扫描行数二百多万,未利用好索引explain表:额外建议:索引建议:
    114+ AND b.pending_move_number- IFNULL(f.sumNumber, 0) &gt; 0;王凯,人工修改过AISQL修改建议:扫描行数二百多万,未利用好索引explain表:额外建议:索引建议:
    034- (3636043,20115231,9917258,17929370,3001828,19773708,9530699,19544810,19073720,17337733,7816027,16893426,18666805,17047235,20827446,17691430,5629714,21498031,18612132,6046898,11707335,13914543,5121493,13970486,4379683,17355013,10776974,18788993,16891042,20712651,18890378,9322160,16339249,5971103,9357040,19440655,17853459,14447785,19661086,10485061,21135948,19517753,14021483,19606169,4640024,17256713,21451464,13759159,4386188,8385048,4301881,20488072,18123147,12839831,17293202,10066889,14472480,18739886,6053123,13683516,4983256,14720559,17705535,7230108,15475979,11905205,17330389,4670102,11648538,15041159,6139934,17216145,16864143,20700507,10028040,17391428,10764691,16837908,6394534,14431907,18845225,17507232,14424098,7951583,16273785,7847350,17493305,20159778,4901821,19257040,21310129,21151911,19062338,19085699,6598298,20096125,20440624,4813367,11798691,14733955,11420621,6859664,20357533,21031783,17227227,9580721,21115200,19434825,10791899,9097197,11703784,11785861,13965432,18048321,20568586,15835327,21456062,15852807,18631265,13403638,12843276,8168964,9354866,9527732,6729500,19588148,17698971,4524455,12613069,18792320,14975913,20091416,10056369,7425545,19455322,19010518,17911497,21404812,19168231,15862517,18994070,20306837,16187497,21001972,8334160,18631587,21529651,5001226,20455955,11028914,10623920,15777335,13791419,19408387,6299392,6493500,8761953,19138060,6455359,14470408,9446440,16199638,3623462,3195916,14770109,14803043,11642560,15667651,13996094,19945305,17591331,10036589,7352233,13396763,19119850,8049415,17581321,21419229,18727903,19625091,14352679,18941264,20999002,21165736,18902732,11582030,15445438,6810304,6049100,6678202,13453393,12029737,3884062,3336911,9457983,6714594,14082324,20811801,19153733,18858299) <br />AND status = 0 <br />AND is_deleted = 0;<br />优化建议:<br />1. 确保在sku字段上有索引(复合索引更好)<br />2. 如果status和is_deleted字段选择性高,可以考虑创建复合索引(sku, status, is_deleted)<br />3. 根据实际使用场景,考虑是否添加其他字段到复合索引中<br />explain表:<br /><br /></p>
    034+ (3636043,20115231,9917258,17929370,3001828,19773708,9530699,19544810,19073720,17337733,7816027,16893426,18666805,17047235,20827446,17691430,5629714,21498031,18612132,6046898,11707335,13914543,5121493,13970486,4379683,17355013,10776974,18788993,16891042,20712651,18890378,9322160,16339249,5971103,9357040,19440655,17853459,14447785,19661086,10485061,21135948,19517753,14021483,19606169,4640024,17256713,21451464,13759159,4386188,8385048,4301881,20488072,18123147,12839831,17293202,10066889,14472480,18739886,6053123,13683516,4983256,14720559,17705535,7230108,15475979,11905205,17330389,4670102,11648538,15041159,6139934,17216145,16864143,20700507,10028040,17391428,10764691,16837908,6394534,14431907,18845225,17507232,14424098,7951583,16273785,7847350,17493305,20159778,4901821,19257040,21310129,21151911,19062338,19085699,6598298,20096125,20440624,4813367,11798691,14733955,11420621,6859664,20357533,21031783,17227227,9580721,21115200,19434825,10791899,9097197,11703784,11785861,13965432,18048321,20568586,15835327,21456062,15852807,18631265,13403638,12843276,8168964,9354866,9527732,6729500,19588148,17698971,4524455,12613069,18792320,14975913,20091416,10056369,7425545,19455322,19010518,17911497,21404812,19168231,15862517,18994070,20306837,16187497,21001972,8334160,18631587,21529651,5001226,20455955,11028914,10623920,15777335,13791419,19408387,6299392,6493500,8761953,19138060,6455359,14470408,9446440,16199638,3623462,3195916,14770109,14803043,11642560,15667651,13996094,19945305,17591331,10036589,7352233,13396763,19119850,8049415,17581321,21419229,18727903,19625091,14352679,18941264,20999002,21165736,18902732,11582030,15445438,6810304,6049100,6678202,13453393,12029737,3884062,3336911,9457983,6714594,14082324,20811801,19153733,18858299) <br />AND status = 0 <br />AND is_deleted = 0;<br />优化建议:<br />1. 确保在sku字段上有索引(复合索引更好)<br />2. 如果status和is_deleted字段选择性高,可以考虑创建复合索引(sku, status, is_deleted)<br />3. 根据实际使用场景,考虑是否添加其他字段到复合索引中<br />explain表:</p>
    114- AND b.pending_move_number- IFNULL(f.sumNumber, 0) &gt; 0;<br />王凯,人工修改过<br />AISQL修改建议:扫描行数二百多万,未利用好索引<br />explain表:<br />额外建议:<br />索引建议:<br /></p>
    114+ AND b.pending_move_number- IFNULL(f.sumNumber, 0) &gt; 0;<br />王凯,人工修改过<br />AISQL修改建议:扫描行数二百多万,未利用好索引<br />explain表:<br />额外建议:<br />索引建议:</p>
  7. 2025-08-25 14:05:24, 由 陈莉珍 关闭。
    修改了 Bug状态 ,旧值为 "resolved",新值为 "closed"。
    修改了 指派给 ,旧值为 "chenlizhen",新值为 "closed"。
    修改了 由谁关闭,旧值为 "",新值为 "chenlizhen"。
    修改了 关闭日期,旧值为 "",新值为 "2025-08-25 14:05:24"。
所属项目 技术中心-需求池
所属模块 多平台   OZON
所属计划
所属迭代
Bug类型
严重程度 一般
优先级 P2
Bug状态 已关闭
业务部门 总经办
影响功能
开发责任人 周凯
测试责任人 周凯
解决时效 0.69
激活次数 0
激活日期
是否确认 是
当前指派 Closed 于 2025-08-25 14:05:24
截止日期 0000-00-00
上线时间 2025-08-25 10:25:00
上线时效 0.74
操作系统
浏览器
关键词
抄送给
所属迭代
相关需求
相关任务
由谁创建 陈莉珍 于 2025-08-25 09:40:46
影响环境 生产环境-业务反馈
由谁解决 周凯 于 2025-08-25 10:22:20
解决版本
解决方案 程序BUG
由谁关闭 陈莉珍 于 2025-08-25 14:05:24
最后修改 陈莉珍 于 2025-08-25 14:05:24
相关Bug