Hello,
I am facing deadlock issue while insert into single table using multiple threads. It is simple insert SP which has code like
Insert into table A output inserted.value into @inserted values(x,y,z).
select @value = value from @inserted
This table A has one PK clustered index on identity column which we get using above output clause and return to app by using an output parameter. Other information to consider is that this sp takes only a second to execute. This table has one PK clustered index and 9 non clustered indexes.
Since this insert sp called by multiple thread at the same time we are facing massive deadlock with wait resource = Object which is the same table. Below is partial deadlock information extracted from deadlock xml file.
-<objectlock id="lock14d48a27e80" associatedObjectId="1013578649" mode="X" objectname="dbo.A" dbid="5" subresource="FULL" objid="1013578649" lockPartition="0">
-<owner-list>
<owner id="process15250169848" mode="IX" requestType="wait"/>
</owner-list>
-<waiter-list>
<waiter id="process151ae699088" mode="X" requestType="wait"/>
</waiter-list>
</objectlock>
-<objectlock id="lock14d48a27e80" associatedObjectId="1013578649" mode="X" objectname="dbo.A" dbid="5" subresource="FULL" objid="1013578649" lockPartition="0">
-<owner-list>
<owner id="process15250169848" mode="IX" requestType="wait"/>
</owner-list>
-<waiter-list>
<waiter id="process153993c2ca8" mode="X" requestType="wait"/>
</waiter-list>
Appreciate if any help from you guys.