Overview
This guide provides best‑practice recommendations and tools to monitor the performance of Azure SQL Database. Learn how to collect metrics, interpret telemetry, and tune your workloads for optimal throughput and latency.
Key Metrics
| Metric | Description | Unit | Suggested Threshold |
|---|---|---|---|
| DTU Consumption | Composite measure of CPU, memory, reads, and writes. | DTU % | >80% sustained |
| CPU % | CPU utilization of the database. | % | >75% sustained |
| Data IO | Logical reads per second. | MB/s | >70% of allocated |
| Log IO | Writes to transaction log. | MB/s | >75% of allocated |
| Deadlocks | Number of deadlock events per minute. | Count/min | >0 (alert) |
| Wait Statistics | Top wait types contributing to latency. | ms | Analyze top 5 |
Monitoring Tools
Azure Portal
SQL Analytics
PowerShell / CLI
Use the Metrics Explorer in the Azure portal to view real‑time charts of DTU, CPU, and IO.
Best Practices
- Set up alerts for CPU, DTU, and deadlock thresholds.
- Enable Query Performance Insight to identify long‑running queries.
- Periodically review wait statistics and index usage.
- Scale up or out based on observed trends, not just spikes.
- Leverage Automatic Tuning for index recommendations.
Sample Monitoring Query (Dynamic Management Views)
SELECT
r.session_id,
r.start_time,
DATEDIFF(SECOND, r.start_time, GETDATE()) AS duration_sec,
SUBSTRING(t.text, (r.statement_start_offset/2)+1,
((CASE r.statement_end_offset
WHEN -1 THEN DATALENGTH(t.text)
ELSE r.statement_end_offset END
- r.statement_start_offset)/2)+1) AS query_text,
r.status,
r.command,
r.total_elapsed_time/1000 AS total_ms,
r.cpu_time/1000 AS cpu_ms,
r.reads, r.writes
FROM sys.dm_exec_requests r
CROSS APPLY sys.dm_exec_sql_text(r.sql_handle) t
WHERE r.session_id > 50
ORDER BY r.cpu_time DESC;