[步骤]
问题描述:
严重级别:严重所属项目:FBA虚拟库
问题原因:超慢SQL、查询时间700秒左右,已截断SQL为:(
select
DISTINCT
iv.item_name as productNameEn,
iv.product_name_cn as productNameCn,
ct.p_asin as parentAsin,
ct.asin,
ct.msku,
ct.sku,
ct.source_id,
ct.country_code,
iv.image_url,
ct.salesman_id,
ct.salesman_name,
ct.first_business_people_id,
ct.first_business_people_name
from t_amz_fba_virtual_inventory iv join t_amz_fba_virtual_inventory_country ct on iv.id = ct.virtual_id
where
iv.warehouse_type in(3,4)
and
(
(
ct.source_id = 22429 and ct.msku= 'amzn.gr.8x10-L24023G-Light_Tan-v8fGpu-VG'
or
ct.source_id = 20811 and ct.msku= 'amzn.gr.CB-FYJY-09EN-W1SUYJu490QdNAnb-LN'
or
ct.source_id = 16331 and ct.msku= '775-WWNN-WWNN-G-4MS'
or
ct.source_id = 22429 and ct.msku= 'amzn.gr.19568143-4Roundft-L240-ByP4Zc-VG'
or
ct.source_id = 20810 and ct.msku= 'amzn.gr.CB-FYJY-09EN-W1SUYJu490QdNAnb-LN'
or
ct.source_id = 8013 and ct.msku= 'amzn.gr.RU7Q117U20Z1W7102DPB5W-FrxK4C-LN'
or
ct.source_id = 20812 and ct.msku= 'amzn.gr.CB-FYJY-09EN-W1SUYJu490QdNAnb-LN'
or
ct.source_id = 16544 and ct.msku= '9G-TQZ2-GPNM'
or
);
[结果]
[期望]
解决方案:一次性不能OR(查)太多(建议200以内,或找个合适的范围)