Forum Discussion

sebd's avatar
sebd
Copper Contributor
Jan 22, 2025
Solved

Deadlocks on High Frequency Updates

Using SQL Server 2022, I'm stress testing an UPDATE statement. I'm using a python script to send parallel requests to the database. The problem is that, as soon as the number of parallel requests exc...
  • VladDBA's avatar
    Jan 23, 2025

    Right off the bat: do you have a nonclustered index on the columns in the UPDATE statement's WHERE clause?

    CREATE INDEX UsersAnswer_ncix ON UsersAnswer(For_Question,For_Quiz,FK_Answer);

    If not, create it and monitor for changes in deadlock occurrence.

    P.S. I'd recommend against turning the table into a heap by turning the PK into a NC index.

Resources