seniorT-SQL

What is SQL Server deadlock priority and victim selection algorithm?

Updated May 17, 2026

Short answer

SQL Server selects a deadlock victim based on cost and optional session priority settings.

Deep explanation

When a deadlock occurs, SQL Server evaluates each participating transaction's rollback cost. The transaction with the lowest cost is chosen as the victim. Developers can influence selection using DEADLOCK_PRIORITY. Higher priority sessions are less likely to be chosen as victims. The goal is to minimize rollback work while resolving the cycle quickly.

Unlock with a Pro subscription to view this section.

View pricing

Real-world example

No real-world example available yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

Common mistakes

No common mistakes listed yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

Follow-up questions

No follow-up questions available yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

More T-SQL interview questions

View all →