I have one table with one row in it.
CREATE TABLE [dbo].[SYS_TRAN_ID](
[NEXT_ID] [dbo].[id] NOT NULL,
[PROCESS_ID] [dbo].[processid] NOT NULL,
CONSTRAINT [XPKSTRANID] PRIMARY KEY CLUSTERED
(
[NEXT_ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90) ON [PRIMARY]
) ON [PRIMARY]
END
GO
We occassionaly get deadlocks on this table with multiple SPIDs running this,
update SYS_TRAN_ID
set NEXT_ID = ( NEXT_ID + 1 ),
@newID = NEXT_ID
The deadlock information is,
deadlock-list><deadlock victim="processaa31948"><process-list><process id="processaa31948" taskpriority="0" logused="0" waitresource="KEY: 5:342430164582400
(400041cd0cd1)" waittime="100" ownerId="8034737737" transactionname="UPDATE" lasttranstarted="2013-06-12T08:53:59.330" XDES="0x952a21790" lockMode="U" schedulerid="5" kpid="3204"
status="suspended" spid="687" sbid="0" ecid="0" priority="0" trancount="2" lastbatchstarted="2013-06-12T08:53:59.330" lastbatchcompleted="2013-06-12T08:53:59.180" clientapp="CLAIMSTATION"
hostname="PC6970A" hostpid="868" loginname="bnahrc" isolationlevel="read committed (2)" xactid="8034737737" currentdb="5" lockTimeout="4294967295" clientoption1="671088672" clientoption2="128056"
databaseName="CWS_PROD"><executionStack><frame procname="CWS_PROD.dbo.xpi_GetNextID" line="65" stmtstart="3062" stmtend="3222" sqlhandle="0x0300050085bd2a1af9b38800b69d00000100000000000000">
update SYS_TRAN_ID
set NEXT_ID = ( NEXT_ID + 1 ),
@newID = NEXT_ID </frame></executionStack><inputbuf>
Proc [Database Id = 5 Object Id = 439008645] </inputbuf></process><process id="process584f948" taskpriority="0" logused="0" waitresource="KEY: 5:342430164582400 (3500ef9ded8d)" waittime="4837"
ownerId="8034775524" transactionname="UPDATE" lasttranstarted="2013-06-12T08:54:04.303" XDES="0x2dd548e90" lockMode="U" schedulerid="16" kpid="7232" status="suspended" spid="744"
sbid="0" ecid="0" priority="0" trancount="2" lastbatchstarted="2013-06-12T08:54:04.303" lastbatchcompleted="2013-06-12T08:54:04.200" clientapp="CLAIMSTATION" hostname="PC6877"
hostpid="5784" loginname="blopmm" isolationlevel="read committed (2)" xactid="8034775524" currentdb="5" lockTimeout="4294967295" clientoption1="671088672" clientoption2="128056"
databaseName="CWS_PROD"><executionStack><frame procname="CWS_PROD.dbo.xpi_GetNextID" line="65" stmtstart="3062" stmtend="3222" sqlhandle="0x0300050085bd2a1af9b38800b69d00000100000000000000">
update SYS_TRAN_ID
set NEXT_ID = ( NEXT_ID + 1 ),
@newID = NEXT_ID </frame></executionStack><inputbuf>
Proc [Database Id = 5 Object Id = 439008645] </inputbuf></process><process id="process5844e08" taskpriority="0" logused="1832" waitresource="KEY: 5:342430164582400 (3500ef9ded8d)" waittime="96"
ownerId="8033146025" transactionname="implicit_transaction" lasttranstarted="2013-06-12T08:48:24.597" XDES="0x63ca5b970" lockMode="U" schedulerid="15" kpid="5696" status="suspended"
spid="517" sbid="0" ecid="0" priority="0" trancount="2" lastbatchstarted="2013-06-12T08:54:09.070" lastbatchcompleted="2013-06-12T08:54:09.067" clientapp="CLAIMSTATION" hostname="PC9931"
hostpid="3912" loginname="daughers" isolationlevel="read committed (2)" xactid="8033146025" currentdb="5" lockTimeout="4294967295" clientoption1="671088672" clientoption2="128058"
databaseName="CWS_PROD"><executionStack><frame procname="CWS_PROD.dbo.xpi_GetNextID" line="65" stmtstart="3062" stmtend="3222" sqlhandle="0x0300050085bd2a1af9b38800b69d00000100000000000000">
update SYS_TRAN_ID
set NEXT_ID = ( NEXT_ID + 1 ),
@newID = NEXT_ID </frame></executionStack><inputbuf>
Proc [Database Id = 5 Object Id = 439008645] </inputbuf></process></process-list><resource-list><keylock hobtid="342430164582400" dbid="5" objectname="CWS_PROD.dbo.SYS_TRAN_ID" indexname="XPKSTRANID"
id="lockb2e654f80" mode="X" associatedObjectId="342430164582400"><owner-list><owner id="process5844e08" mode="X" /></owner-list><waiter-list><waiter id="processaa31948"
mode="U" requestType="wait" /></waiter-list></keylock><keylock hobtid="342430164582400" dbid="5" objectname="CWS_PROD.dbo.SYS_TRAN_ID" indexname="XPKSTRANID" id="lock9a2614880"
mode="U" associatedObjectId="342430164582400"><owner-list><owner id="processaa31948" mode="U" /></owner-list><waiter-list><waiter id="process584f948" mode="U" requestType="wait"
/></waiter-list></keylock><keylock hobtid="342430164582400" dbid="5" objectname="CWS_PROD.dbo.SYS_TRAN_ID" indexname="XPKSTRANID" id="lock9a2614880" mode="U" associatedObjectId="342430164582400"><owner-list
/><waiter-list><waiter id="process5844e08" mode="U" requestType="wait" /></waiter-list></keylock></resource-list></deadlock></deadlock-list>
Everything I have read thus far deals with update statements with where clauses and using a non-clustered index to cover the query. Can't find anything for my specific example of a table with just a clustered index and no where clause in the update statement. Any suggestions to help this deadlock issue?