Home > database >  SQL server deadlock problem
SQL server deadlock problem

Time:10-11

Deadlock problem, don't understand why the deadlock, strives for the bosses analysis detailed reasons and lock, such as waiting for the detailed process of process, in order to understand the solution
Information is as follows:

TOnlineUser deadlock occurs table index information:
Name: IX_tOnlineUser
Type: nonclustered, ignore the duplicate keys, unique located on PRIMARY
Indexed column: iUserID

Deadlock image information:


- SP1 sacrificed
SELECT @ iDbGsID=iGameServerID, @ bDbState=bState FROM tOnlineUser WHERE iUserID=@ iUserID
The UPDATE tOnlineUser SET bState=3 WHERE iUserID=@ iUserID


- SP2
The DELETE FROM tOnlineUser WHERE iUserID=@ iUserID
INSERT tOnlineUser (iUserID iGameServerID, bState) VALUES (@ iUserID @ iGsID, @ bOnlineState)


Deadlock XML information is as follows:
 
Deadlock graph & lt; Deadlock - list>



<frame procname="BOX_RunCenter. Dbo. Me_UserOnlineState" line="35" stmtstart="890" stmtend="1014" sqlhandle="0 x03000e005cbf2019d1d51601ada700000100000000000000 & gt;"
The DELETE FROM tOnlineUser WHERE iUserID=@ iUserID

- online or offline & lt;/frame>


Proc/Database Id=14 Object Id=421576540]




<frame procname="BOX_RunCenter. Dbo. Me_GetUserOnlineServerID" line="39" stmtstart="1206" stmtend="1404" sqlhandle="0 x03000e00b1524416c8d51601ada700000100000000000000 & gt;"
SELECT @ iGsID=iGameServerID, @ bState=bState FROM tOnlineUser WHERE iUserID=@ iUserID

- no record & lt;/frame>


Proc/Database Id=14 Object Id=373576369]





















  • Related