重现步骤

[步骤]

declare @CustomerID int= 1 ,@OrderSourceID int= 9500

SELECT alias.*,                             b.ItemID,                             c.SKU,                             c.OrderSourceSKU,                             c.Quantity,                             c.ProductType as MainProductType,                             c.IsVariation as IsProductVariation,                             Isnull(p.ProductState, 0)         AS ProductState,                             B.Duration                      FROM   RB_Ebay_Listing_AutoSupplement_V2 alias WITH(nolock)                             INNER JOIN RB_Ebay_Listing_Basic_V2 b WITH(nolock)                               ON alias.CustomerID = b.CustomerID                                  AND alias.ListingBasicID = b.ListingBasicID                                  AND alias.OrderSourceID = b.OrderSourceID                             INNER JOIN RB_Ebay_Listing_Product_V2 c WITH(nolock)                               ON alias.CustomerID = c.CustomerID                                  AND alias.ListingBasicID = c.ListingBasicID                                  AND alias.ListingProductID = c.ListingProductID                                  AND alias.OrderSourceID = c.OrderSourceID                              LEFT JOIN RB_Product p WITH(nolock)                               ON c.CustomerID = p.CustomerID                                  AND c.SKU = p.SKU                      WHERE  b.OnlineState = 1                             AND b.ListingType = 8                             AND alias.CustomerID = @CustomerID                             AND alias.OrderSourceID = @OrderSourceID                             AND alias.EnableAutoSupplement = 1                              AND ( alias.IsInventoryCheck is null or alias.IsInventoryCheck = 0 )  



[结果]


[期望]

优化性能,提升效率


历史记录  
  1. 2022-04-19 14:20:43, 由 袁慧斌 创建。
  2. 2022-04-21 09:59:49, 由 胡晓龙 指派给 罗友军。
    修改了 指派给,旧值为 "huxiaolong",新值为 "luoyoujun"。
  3. 2022-04-21 10:04:31, 由 罗友军 指派给 陈少军。
    修改了 指派给,旧值为 "luoyoujun",新值为 "chenshaojun"。
  4. 2022-04-21 10:35:09, 由 胡晓龙 编辑。
    修改了 影响环境,旧值为 "569",新值为 "577"。
    修改了 重现步骤,区别为:
    002- declare @CustomerID int= 1 ,@OrderSourceID int= 9500SELECT alias.*, b.ItemID, c.SKU, c.OrderSourceSKU, c.Quantity, c.ProductType as MainProductType, c.IsVariation as IsProductVariation, Isnull(p.ProductState, 0) AS ProductState, B.Duration FROM RB_Ebay_Listing_AutoSupplement_V2 alias WITH(nolock) INNER JOIN RB_Ebay_Listing_Basic_V2 b WITH(nolock) ON alias.CustomerID = b.CustomerID AND alias.ListingBasicID = b.ListingBasicID AND alias.OrderSourceID = b.OrderSourceID INNER JOIN RB_Ebay_Listing_Product_V2 c WITH(nolock) ON alias.CustomerID = c.CustomerID AND alias.ListingBasicID = c.ListingBasicID AND alias.ListingProductID = c.ListingProductID AND alias.OrderSourceID = c.OrderSourceID LEFT JOIN RB_Product p WITH(nolock) ON c.CustomerID = p.CustomerID AND c.SKU = p.SKU WHERE b.OnlineState = 1 AND b.ListingType = 8 AND alias.CustomerID = @CustomerID AND alias.OrderSourceID = @OrderSourceID AND alias.EnableAutoSupplement = 1 AND ( alias.IsInventoryCheck is null or alias.IsInventoryCheck = 0 )
    002+ declare @CustomerID int= 1 ,@OrderSourceID int= 9500SELECT alias.*, b.ItemID, c.SKU, c.OrderSourceSKU, c.Quantity, c.ProductType as MainProductType, c.IsVariation as IsProductVariation, Isnull(p.ProductState, 0) AS ProductState, B.Duration FROM RB_Ebay_Listing_AutoSupplement_V2 alias WITH(nolock) INNER JOIN RB_Ebay_Listing_Basic_V2 b WITH(nolock) ON alias.CustomerID = b.CustomerID AND alias.ListingBasicID = b.ListingBasicID AND alias.OrderSourceID = b.OrderSourceID INNER JOIN RB_Ebay_Listing_Product_V2 c WITH(nolock) ON alias.CustomerID = c.CustomerID AND alias.ListingBasicID = c.ListingBasicID AND alias.ListingProductID = c.ListingProductID AND alias.OrderSourceID = c.OrderSourceID LEFT JOIN RB_Product p WITH(nolock) ON c.CustomerID = p.CustomerID AND c.SKU = p.SKU WHERE b.OnlineState = 1 AND b.ListingType = 8 AND alias.CustomerID = @CustomerID AND alias.OrderSourceID = @OrderSourceID AND alias.EnableAutoSupplement = 1 AND ( alias.IsInventoryCheck is null or alias.IsInventoryCheck = 0 )
    003-
    003+
    002- <p>declare @CustomerID int= 1 ,@OrderSourceID int= 9500<br /><br />SELECT alias.*, b.ItemID, c.SKU, c.OrderSourceSKU, c.Quantity, c.ProductType as MainProductType, c.IsVariation as IsProductVariation, Isnull(p.ProductState, 0) AS ProductState, B.Duration FROM RB_Ebay_Listing_AutoSupplement_V2 alias WITH(nolock) INNER JOIN RB_Ebay_Listing_Basic_V2 b WITH(nolock) ON alias.CustomerID = b.CustomerID AND alias.ListingBasicID = b.ListingBasicID AND alias.OrderSourceID = b.OrderSourceID INNER JOIN RB_Ebay_Listing_Product_V2 c WITH(nolock) ON alias.CustomerID = c.CustomerID AND alias.ListingBasicID = c.ListingBasicID AND alias.ListingProductID = c.ListingProductID AND alias.OrderSourceID = c.OrderSourceID LEFT JOIN RB_Product p WITH(nolock) ON c.CustomerID = p.CustomerID AND c.SKU = p.SKU WHERE b.OnlineState = 1 AND b.ListingType = 8 AND alias.CustomerID = @CustomerID AND alias.OrderSourceID = @OrderSourceID AND alias.EnableAutoSupplement = 1 AND ( alias.IsInventoryCheck is null or alias.IsInventoryCheck = 0 )<br /></p><div><br /></div>
    002+ <p>declare @CustomerID int= 1 ,@OrderSourceID int= 9500<br /><br />SELECT alias.*, b.ItemID, c.SKU, c.OrderSourceSKU, c.Quantity, c.ProductType as MainProductType, c.IsVariation as IsProductVariation, Isnull(p.ProductState, 0) AS ProductState, B.Duration FROM RB_Ebay_Listing_AutoSupplement_V2 alias WITH(nolock) INNER JOIN RB_Ebay_Listing_Basic_V2 b WITH(nolock) ON alias.CustomerID = b.CustomerID AND alias.ListingBasicID = b.ListingBasicID AND alias.OrderSourceID = b.OrderSourceID INNER JOIN RB_Ebay_Listing_Product_V2 c WITH(nolock) ON alias.CustomerID = c.CustomerID AND alias.ListingBasicID = c.ListingBasicID AND alias.ListingProductID = c.ListingProductID AND alias.OrderSourceID = c.OrderSourceID LEFT JOIN RB_Product p WITH(nolock) ON c.CustomerID = p.CustomerID AND c.SKU = p.SKU WHERE b.OnlineState = 1 AND b.ListingType = 8 AND alias.CustomerID = @CustomerID AND alias.OrderSourceID = @OrderSourceID AND alias.EnableAutoSupplement = 1 AND ( alias.IsInventoryCheck is null or alias.IsInventoryCheck = 0 )</p>
    003-
    003+ <div><br /></div>
  5. 2022-04-21 14:43:48, 由 陈少军 解决,方案为 性能问题 。
    修改了 解决方案,旧值为 "",新值为 "performance"。
    修改了 解决版本,旧值为 "",新值为 "569"。
    修改了 解决日期,旧值为 "",新值为 "2022-04-21 14:38:43"。
    修改了 指派给 ,旧值为 "chenshaojun",新值为 "luoyoujun"。
    修改了 Bug状态 ,旧值为 "active",新值为 "resolved"。
    修改了 是否确认,旧值为 "0",新值为 "1"。
    修改了 解决者 ,旧值为 "",新值为 "chenshaojun"。

    测试执行sql 已经使用了索引查找,查询出55.5万数据用时41秒;


     去掉 alias.*,  查询出55.5万数据用时21秒;


    优化建议: 将SELECT alias.*  修改为查询具体需使用的字段

  6. 2022-04-21 14:44:31, 由 罗友军 指派给 魏鹏军。
    修改了 指派给,旧值为 "luoyoujun",新值为 "weipengjun"。
  7. 2022-04-21 14:44:41, 由 陈少军 指派给 罗友军。
    修改了 指派给,旧值为 "weipengjun",新值为 "luoyoujun"。
    修改了 抄送给,旧值为 "",新值为 ",huxiaolong,yuanhuibin"。

    测试执行sql 已经使用了索引查找,查询出55.5万数据用时41秒;


     去掉 alias.*,  查询出55.5万数据用时21秒;


    优化建议: 将SELECT alias.*  修改为查询具体需使用的字段,不要使用 * 

  8. 2022-04-21 14:45:43, 由 罗友军 指派给 魏鹏军。
    修改了 指派给,旧值为 "luoyoujun",新值为 "weipengjun"。
  9. 2022-04-21 15:37:33, 由 魏鹏军 指派给 李乐同。
    修改了 指派给,旧值为 "weipengjun",新值为 "liletong"。
    已按照少军优化建议将alias.*改为具体字段
  10. 2022-04-24 21:20:52, 由 胡晓龙 编辑。
    修改了 所属模块,旧值为 "1644",新值为 "1694"。
  11. 2022-04-25 18:57:32, 由 李乐同 指派给 袁慧斌。
    修改了 指派给,旧值为 "liletong",新值为 "yuanhuibin"。
    修改了 抄送给,旧值为 ",huxiaolong,yuanhuibin",新值为 ""。
    2022/4/25上线,线上帮忙跟进是否正常,再关闭bug
  12. 2022-09-21 13:50:45, 由 袁慧斌 关闭。
    修改了 Bug状态 ,旧值为 "resolved",新值为 "closed"。
    修改了 指派给 ,旧值为 "yuanhuibin",新值为 "closed"。
    修改了 由谁关闭,旧值为 "",新值为 "yuanhuibin"。
    修改了 关闭日期,旧值为 "",新值为 "2022-09-21 13:50:45"。
    已未发现
  13. 2023-11-17 09:53:57, 由 刘超 编辑。
    修改了 所属模块,旧值为 "0",新值为 "1863"。
所属项目 技术中心-需求池
所属模块 系统运维   性能优化
所属计划
所属迭代
Bug类型
严重程度 提示
优先级 P0
Bug状态 已关闭
业务部门
影响功能
开发责任人
测试责任人
解决时效 0
激活次数 0
激活日期
是否确认 是
当前指派 Closed 于 2022-09-21 13:50:45
截止日期 0000-00-00
上线时间
上线时效
操作系统
浏览器
关键词
抄送给
所属迭代
相关需求
相关任务
由谁创建 袁慧斌 于 2022-04-19 14:20:43
影响环境 577
由谁解决 陈少军 于 2022-04-21 14:38:43
解决版本 569
解决方案 性能问题
由谁关闭 袁慧斌 于 2022-09-21 13:50:45
最后修改 刘超 于 2023-11-17 09:53:48
相关Bug