70-465 · Question #15
You are troubleshooting an application that runs a query. The application frequently causes deadlocks. You need to identify which transaction causes the deadlock. What should you do? More than one ans
The correct answer is D. Create an extended events session to capture deadlock information.. To identify which transaction causes a deadlock in SQL Server, you need a mechanism that captures deadlock events with detailed information about the involved transactions. Extended Events is the modern, recommended approach for this.
Question
Options
- AQuery the sys.dm_exec_requests dynamic management view.
- BCreate a trace in SQL Server Profiler that contains the Deadlock graph event.
- CQuery the sys.dm_exec_sessions dynamic management view.
- DCreate an extended events session to capture deadlock information.
How the community answered
(19 responses)- B11% (2)
- C5% (1)
- D84% (16)
Why each option
To identify which transaction causes a deadlock in SQL Server, you need a mechanism that captures deadlock events with detailed information about the involved transactions. Extended Events is the modern, recommended approach for this.
sys.dm_exec_requests shows currently executing requests in real time, but deadlocks are transient events that resolve instantly, making it nearly impossible to capture the deadlock transaction before it is rolled back.
While the Deadlock graph event in SQL Server Profiler can identify deadlock transactions, Profiler is deprecated in favor of Extended Events and introduces significantly higher server overhead, making it a less optimal solution.
sys.dm_exec_sessions shows active session information but does not capture deadlock events or provide historical data about which transactions caused a deadlock, as the sessions involved are terminated before they can be queried.
Extended Events sessions can capture the 'xml_deadlock_report' or 'sqlserver.xml_deadlock_report' event, which provides a detailed XML graph identifying all transactions, resources, and the victim involved in a deadlock. Extended Events is the preferred and most efficient method in modern SQL Server versions, offering lower overhead than SQL Server Profiler while providing richer, persistent deadlock diagnostic data that can be analyzed after the fact.
Concept tested: Capturing SQL Server deadlock information using Extended Events
Source: https://learn.microsoft.com/en-us/sql/relational-databases/extended-events/use-extended-events-to-capture-deadlocks
Topics
Community Discussion
No community discussion yet for this question.