1205: Transaction (Process ID) was deadlocked on lock resources with another process and has been chosen as the deadlock victim
SQL ServerWhat does it mean?
Two or more transactions each wait for locks held by the other (a deadlock). To break the cycle, SQL Server picks one transaction as the victim and rolls it back.
Why does it happen?
Transactions locking tables/rows in different orders, long-running transactions, wide scans caused by missing indexes, lock escalation and high concurrency are the typical causes.
How to fix it
Catch error 1205 in the application and retry the transaction automatically. Access objects in the same order in every transaction and keep transactions short. Examine the deadlock graph: use Extended Events (the system_health session) or trace flag 1222 for details. Add appropriate indexes to reduce scanning and locking. If needed, evaluate the READ COMMITTED SNAPSHOT (RCSI) isolation level.
More from this engine
- 2627Violation of PRIMARY KEY / UNIQUE KEY constraint. Cannot insert duplicate key in object
- 2601Cannot insert duplicate key row in object with unique index. The duplicate key value is ...
- 547The INSERT/UPDATE/DELETE statement conflicted with the FOREIGN KEY / CHECK constraint
- 18456Login failed for user