thinQmaster Virtual testing partner Adaptive practice exams that find your weak spots and drill them. Every answer explained. From $69
Enroll

thinQmaster

Find your exam

Five questions free, before you decide.

Step 1 · choose a vendor

In one of our camps? Your practice exams come with the tuition — they are on your study page already.

Data & Analytics · Intermediate

Deadlock

A cycle in which two or more transactions each hold a lock the other needs, so none can proceed.

Definition

The database detects deadlocks and kills one transaction (the victim), rolling it back with an error such as SQL Server error 1205. Prevention includes accessing objects in a consistent order, keeping transactions short and using appropriate indexes and isolation levels.

Example

Txn A locks Orders then waits on Customers; Txn B locks Customers then waits on Orders.

Exam tip

To reduce deadlocks, access tables in the same order and keep transactions short; applications should retry the victim.

Related terms