
SQL DBA Tools: Sudden Performance Drops via Parameter Sniffing
August 6, 2026

Deadlocks in Azure SQL Database can be challenging to diagnose. This guide covers how to detect them using the ring buffer, extract deadlock XML, visualize the deadlock graph in SSMS, and resolve the root cause.
Deadlocks can be a challenging issue to deal with in Azure SQL Database, but with the right strategies and tools, you can effectively detect and resolve them.
The following query retrieves deadlock events from the system ring buffer target and extracts the deadlock XML for analysis:
WITH ring_buffer AS (
SELECT CAST(target_data AS XML) AS rb
FROM sys.dm_xe_database_session_targets t
JOIN sys.dm_xe_database_sessions s ON t.event_session_address = s.address
WHERE s.name = 'system_health'
AND t.target_name = 'ring_buffer'',
), dx AS (
SELECT dxdr.evtdata.query('.') AS deadlock_xml_deadlock_report
FROM ring_buffer
CROSS APPLY rb.nodes('/RingBufferTarget/event[@name=''database_xml_deadlock_report'']') AS dxdr(evtdata)
)
SELECT
d.query('/event/data[@name=''deadlock_cycle_id'']/value').value('(/value)[1]', 'int') AS deadlock_cycle_id
, d.value('(/event/@timestamp)[1]', 'DateTime2') AS deadlock_timestamp
, d.query('/event/data[@name=''database_name'']/value').value('(/value)[1]', 'nvarchar(256)') AS database_name
, d.query('/event/data[@name=''xml_report'']/value/deadlock') AS deadlock_xml
, LTRIM(RTRIM(REPLACE(REPLACE(d.value('.', 'nvarchar(2000)'), CHAR(10), ' '), CHAR(13), ' '))) AS query_text
FROM dx
CROSS APPLY deadlock_xml_deadlock_report.nodes('(/event/data/value/deadlock/process-list/process/inputbuf)') AS ib(d)
ORDER BY deadlock_timestamp DESCClick the deadlock_xml value returned by the query. SQL Server Management Studio will open a new tab showing the raw XML. Save that as an .xdl file and open the .xdl file in SSMS. From there you will see the visual deadlock graph showing all processes and resources involved.
When it comes to resolving deadlocks, there are several approaches you can take:
Regularly monitoring the performance of your Azure SQL Database can help you identify potential deadlock issues before they escalate. Use Azure Monitor to track performance metrics and set up alerts for unusual spikes or patterns.
Consider automating deadlock detection by setting up alerting mechanisms that notify you when a deadlock occurs. This proactive approach can help you address deadlocks promptly and minimize their impact on your operations.
Datazip provides expert Azure SQL monitoring and 24/7 managed DBA services. Call 1-833-DATAZIP or visit www.SQLBrainBox.com for our monitoring tool.
Datazip provides 24/7 managed backup monitoring, encryption, and Azure Recovery Vault setup. US-based engineers, fluent in T-SQL.