1. 问题分析
此死锁来此阿里云日志死锁,事务(进程ID 187)在另一个进程的锁资源上处于死锁状态,已被选为死锁受害者
此查询受另一个进程的影响,
2.解决方案
将sql里的b.SKU IN 查询改为临时表或表值参数后join 查询,提高查询的速度
3.死锁SQL
SELECT
b.ListingBasicID
FROM RB_Ebay_Listing_Basic_V2 a(NOLOCK)
inner join RB_Ebay_Listing_Product_V2 b(nolock)
on a.CustomerID=b.CustomerID
and a.ListingBasicID=b.ListingBasicID
WHERE a.CustomerID = @CustomerID
AND a.OnlineState=1
AND a.ListingType = 8
AND a.OrderSourceID = @OrderSourceID
AND b.SKU IN (SELECT item FROM Charsplitforin(@SKUs, ','))
PARAMS:@CustomerID = 1 ,@OrderSourceID = 7970 ,@SKUs = 10214744,10358552,10446371,10555428,10599882,10951565,11044243,11064991,11081870,11463888,11766632,12015188,12029737,13069420,13454905,13507779,14019195,2181296,2276408,2417600,3401013,3472396,3520824,3786523,4197838,4688147,4932598,5070762,5368451,5542098,5582166,5728605,5730947,5816491,6086839,6425817,6842920,6977183,7419620,7473707,7623925,7958257,8055275,8379824,8400866,8562225,8586838,8605277,9050099,9554736 ,
MESSAGE:Transaction (Process ID 148) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.
Cannot continue the execution because the session is in the kill state.
当前命令发生了严重错误。应放弃任何可能产生的结果。
