重现步骤

[步骤]



[11:06:45]  -------------------------------------------------------------
CODE:N11064532
Error:21_596_1_-2146232060
SQL:select top 5000 ID into #tempid from rb_product WITH(NOLOCK) where id>0 order by id;
SELECT p.ID,
p.SKU,
p.CustomerID,
(SELECT Sum(psd.SalesNum) FROM RB_Report_SKUDay psd WITH(NOLOCK) WHERE p.SKU = psd.SKU AND p.CustomerID = psd.CustomerID AND psd.SalesDay > Dateadd(dd, -7, Getdate()))  SalesNum7,
(SELECT Sum(psd.SalesNum) FROM RB_Report_SKUDay psd WITH(NOLOCK) WHERE p.SKU = psd.SKU AND p.CustomerID = psd.CustomerID AND psd.SalesDay > Dateadd(dd, -14, Getdate())) SalesNum14,
(SELECT Sum(psd.SalesNum) FROM RB_Report_SKUDay psd WITH(NOLOCK) WHERE p.SKU = psd.SKU AND p.CustomerID = psd.CustomerID AND psd.SalesDay > Dateadd(dd, -30, Getdate())) SalesNum30,
(SELECT Sum(psd.SalesNum) FROM RB_Report_SKUDay psd WITH(NOLOCK) WHERE  p.SKU = psd.SKU AND p.CustomerID = psd.CustomerID AND psd.SalesDay > Dateadd(dd, -90, Getdate())) SalesNum90,
pa.AddTime,
pa.DevelopTime,
pa.CheckTime,
(SELECT Isnull((CASE WHEN Isnull(Max(LastOutOperateTime), 0) > Isnull(Max(LastInOperateTime), 0)
                     THEN Isnull(Datediff(day, Max(LastOutOperateTime), Getdate()), 0)
                     ELSE Isnull(Datediff(day, Max(LastInOperateTime), Getdate()), 0)
                     END ), 0) Kl
                FROM View_RB_ProductChina_WareHouse_Table vrpw WITH(NOLOCK) WHERE p.SKU = vrpw.SKU AND p.CustomerID = vrpw.CustomerID) Kl,
(SELECT Isnull(Sum(GoodNum), 0) FROM View_RB_ProductChina_WareHouse_Table vrpw WITH(NOLOCK) WHERE  p.SKU = vrpw.SKU AND p.CustomerID = vrpw.CustomerID) AllGoodNum,   
(SELECT Isnull(MAX(AllWarehouseGoodNum), 0) FROM View_RB_ProductChina_WareHouse_Table vrpw WITH(NOLOCK) WHERE  p.SKU = vrpw.SKU AND p.CustomerID = vrpw.CustomerID)             AllWarehouseGoodNum,
(SELECT Isnull(Avg(AllAvgDailySales), 0) FROM View_RB_ProductChina_WareHouse_Table vrpw WITH(NOLOCK) WHERE p.SKU = vrpw.SKU AND p.CustomerID = vrpw.CustomerID) AllAvgDailySales,
pss.TotalShelvesNum,
pss.ProductNewType,
pss.ProductVitalityType,
Sum(wp.GoodNum) GoodNum
FROM RB_Product p WITH(NOLOCK)
LEFT JOIN RB_Product_Admin pa WITH(NOLOCK) ON p.SKU = pa.SKU AND p.CustomerID = pa.CustomerID
LEFT JOIN RB_Product_SalesStatus pss WITH(NOLOCK) ON pss.SKU = p.SKU AND pss.CustomerID = p.CustomerID
LEFT JOIN RB_WareHouse_Product wp WITH(NOLOCK) ON wp.SKU = p.SKU AND wp.CustomerID = p.CustomerID
WHERE p.CustomerID = 1 AND p.DeleteStatus = 0 and exists(select 1 from #tempid where ID=p.ID)
GROUP BY p.ID,p.SKU,p.CustomerID,pa.AddTime,pa.DevelopTime,pa.CheckTime,pss.TotalShelvesNum,pss.ProductNewType,pss.ProductVitalityType;
drop table #tempid;
PARAMS:
MESSAGE:Cannot continue the execution because the session is in the kill state.
TRACE:   在 System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   在 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
   在 System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
   在 System.Data.SqlClient.SqlDataReader.TryCloseInternal(Boolean closeReader)
   在 System.Data.SqlClient.SqlDataReader.Close()
   在 System.Data.Common.DbDataReader.Dispose(Boolean disposing)
   在 System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
   在 System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
   在 System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable)
   在 RB.DAL.DBOperator.Query(String SQLString, SqlCommand cmd, Int32 Times, SqlParameter[] cmdParms, Boolean IsWriteDB)   在 RB.DAL.DBOperator.toCommonTipException(SqlException ex, String sql, SqlParameter[] cmdParms)
   在 RB.DAL.DBOperator.Query(String SQLString, SqlCommand cmd, Int32 Times, SqlParameter[] cmdParms, Boolean IsWriteDB)
   在 RB.DAL.RB_Product_SalesStatus.RollingQueryProduct(Int32 customerId, Int64 id, Int32 pageSize)
   在 Biz.Irobotbox.Product.ProductActivityClass.RunProductRuleV3()
   在 ChinaDownLoadImage.Task.Product.Task_Product_SetActivityRule.Execute()
   在 RB.Utility.SystemTask.<doTask>b__43_0()
   在 System.Threading.Tasks.Task.Execute()
   在 System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   在 System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)
   在 System.Threading.Tasks.Task.ExecuteEntry(Boolean bPreventDoubleExecution)
   在 System.Threading.ThreadPoolWorkQueue.Dispatch()


[结果]


[期望]

排查问题 优化 SQL 
历史记录  
  1. 2026-09-01 11:08:11, 由 袁慧斌 创建。
  2. 2026-09-01 11:10:32, 由 李乐同 指派给 何建宝。
    修改了 指派给,旧值为 "liletong",新值为 "hejianbao"。
  3. 2026-09-01 11:12:52, 由 何建宝 编辑。
    修改了 严重程度,旧值为 "1",新值为 "2"。
    修改了 解决时效,旧值为 "0",新值为 "-1"。
  4. 2026-09-01 11:13:23, 由 何建宝 指派给 宋宇。
    修改了 指派给,旧值为 "hejianbao",新值为 "songyu"。
  5. 2026-09-01 16:36:16, 由 宋宇 指派给 何建宝。
    修改了 指派给,旧值为 "songyu",新值为 "hejianbao"。
    已处理
  6. 2026-09-01 17:18:26, 由 何建宝 编辑。
    修改了 开发责任人,旧值为 "",新值为 "ZengXiang"。
    修改了 解决时效 ,旧值为 "0",新值为 "-1"。
  7. 2026-09-01 17:18:46, 由 何建宝 解决,方案为 性能问题 。
    修改了 解决方案,旧值为 "",新值为 "performance"。
    修改了 解决版本,旧值为 "",新值为 "trunk"。
    修改了 解决日期,旧值为 "",新值为 "2026-09-01 17:18:29"。
    修改了 指派给 ,旧值为 "hejianbao",新值为 "yuanhuibin"。
    修改了 Bug状态 ,旧值为 "active",新值为 "resolved"。
    修改了 是否确认,旧值为 "0",新值为 "1"。
    修改了 解决者 ,旧值为 "",新值为 "hejianbao"。
    已解决,明天观察下
  8. 2026-09-03 18:37:38, 由 袁慧斌 编辑。
    修改了 测试责任人,旧值为 "",新值为 "admin"。
    修改了 解决时效 ,旧值为 "0",新值为 "6.17"。
    修改了 截止日期 ,旧值为 "0000-00-00",新值为 "2026-09-03"。
    修改了 上线时间 ,旧值为 "0000-00-00 00:00:00",新值为 "2026-09-03 18:30"。
    修改了 上线时效 ,旧值为 "-1",新值为 "55.36"。
  9. 2026-09-03 18:37:42, 由 袁慧斌 关闭。
    修改了 Bug状态 ,旧值为 "resolved",新值为 "closed"。
    修改了 指派给 ,旧值为 "yuanhuibin",新值为 "closed"。
    修改了 由谁关闭,旧值为 "",新值为 "yuanhuibin"。
    修改了 关闭日期,旧值为 "",新值为 "2026-09-03 18:37:42"。
所属项目 技术中心-需求池
所属模块 供应链   产品采购   产品库
所属计划
所属迭代
Bug类型
严重程度 一般
优先级 P1
Bug状态 已关闭
业务部门
影响功能
开发责任人 曾翔
测试责任人 admin
解决时效 6.17
激活次数 0
激活日期
是否确认 是
当前指派 Closed 于 2026-09-03 18:37:42
截止日期 2026-09-03
上线时间 2026-09-03 18:30:00
上线时效 55.36
操作系统
浏览器
关键词
抄送给
所属迭代
相关需求
相关任务
由谁创建 袁慧斌 于 2026-09-01 11:08:11
影响环境 生产环境-线上测试
由谁解决 何建宝 于 2026-09-01 17:18:29
解决版本 主干
解决方案 性能问题
由谁关闭 袁慧斌 于 2026-09-03 18:37:42
最后修改 袁慧斌 于 2026-09-03 18:37:42
相关Bug