任务描述
1.问题分析

   慢sql top 10,缺少索引

2.解决方案: 创建索引

索引优化建议:
  1. 建议在数据表 irobotbox_marketpublish.M_ShopeeV2_Listing 的 OrderSourceCountry,IsGlobal,CustomerId,LastModificationTime 列上添加如下索引,以提高查询性能:
    ALTER TABLE `irobotbox_marketpublish`.`M_ShopeeV2_Listing` ADD INDEX `idx_OrderSourceCountry_IsGlobal_CustomerId_LastModificationTime` (`OrderSourceCountry`, `IsGlobal`, `CustomerId`, `LastModificationTime`)

注意:在业务高峰期,变更表结构存在风险,请谨慎操作!


3.SQL

SELECT `Id`, `CustomerId`, `OrderSourceId`, `OrderSourceCountry`, `IsGlobal`
	, `PartnerId`, `MerchantId`, `ShopId`, `SiteCode`, `Type`
	, `Sku`, `CustomSku`, `ProductId`, `ParentSku`, `SellerSku`
	, `Name`, `MainImage`, `CategoryId`, `HasVariation`, `Currency`
	, `Price`, `OriginalPrice`, `InflatedPrice`, `InflatedOriginalPrice`, `StockLocationId`
	, `StockType`, `Inventory`, `CurrentStock`, `ReservedStock`, `StockLocationId1`
	, `Inventory1`, `CurrentStock1`, `ReservedStock1`, `Weight`, `Length`
	, `Width`, `Height`, `IsPreOrder`, `ShippingTime`, `Condition`
	, `SizeChart`, `CreateTime`, `UpdateTime`, `Status`, `Sales`
	, `Views`, `Likes`, `RatingStar`, `Comments`, `PromotionId`
	, `PublishTime`, `UnPublishTime`, `AutoPublishStrategyId`, `AutoPublishTime`, `IsAutoPublish`
	, `RePublishStrategyId`, `RePublishTime`, `AutoUnPublishStrategyId`, `AutoUnPublishTime`, `AutoAdjustPriceStrategyId`
	, `AutoAdjustPriceTime`, `AutoPromotionStrategyId`, `AutoPromotionTime`, `LastPhoenixPlanStrategyType`, `EditStatus`
	, `LastModifierId`, `LastModifier`, `LastModificationTime`, `CreatorId`, `Creator`
	, `CreationTime`
FROM `M_ShopeeV2_Listing`
WHERE `CustomerId` = 1
	AND `IsGlobal` = 1
	AND 'CN' = `OrderSourceCountry`
	AND '2022-10-17 23:49:16.765115' > `LastModificationTime`
ORDER BY Id DESC
LIMIT 5600, 200
历史记录  
  1. 2022-11-17 15:52:25, 由 陈少军 创建。
  2. 2022-11-18 11:02:45, 由 陈少军 完成。
    修改了 总计消耗,旧值为 "0",新值为 "0.5"。
    修改了 指派给 ,旧值为 "weisicheng",新值为 "chenshaojun"。
    修改了 实际完成,旧值为 "",新值为 "2022-11-18 11:02:29"。
    修改了 任务状态,旧值为 "wait",新值为 "done"。
    修改了 实际开始,旧值为 "0000-00-00 00:00:00",新值为 "2022-11-18 11:02:45"。
    修改了 由谁完成,旧值为 "",新值为 "chenshaojun"。
    已建索引
  3. 2023-10-31 14:53:15, 由 周杰 关闭。
    修改了 任务状态,旧值为 "done",新值为 "closed"。
    修改了 指派给 ,旧值为 "chenshaojun",新值为 "closed"。
    修改了 由谁关闭,旧值为 "",新值为 "zhoujie"。
    修改了 关闭时间,旧值为 "0000-00-00 00:00:00",新值为 "2023-10-31 14:53:15"。
    修改了 关闭原因,旧值为 "",新值为 "done"。
所属迭代 系统管理部 - 系统服务优化
所属模块 /
相关需求 暂无
指派给 Closed 于 2023-10-31 14:53:15
任务类型 后端
任务标签 初始
开发组 有品开发组
任务状态 已关闭
进度 100%
优先级 P2
关键词
抄送给
由谁创建 陈少军 于 2022-11-17 15:52:25
由谁完成 陈少军 于 2022-11-18 11:02:29
由谁取消 暂无
由谁关闭 周杰 于 2023-10-31 14:53:15
关闭原因 已完成
最后编辑 周杰 于 2023-10-31 14:53:15
团队 最初预计 总计消耗 预计剩余
工时信息
最初预计 0工时
总计消耗 0.5工时
预计剩余 0工时
预计开始 2022-11-17
实际开始 2022-11-18
截止日期 2022-11-17