Azure SQL Database Performance

← Back to Overview

Understanding Performance Factors

Azure SQL Database performance is influenced by a combination of service tiers, compute size, query design, and intelligent features built into the platform.

▶️ Core Concepts

Service Tiers: General Purpose, Business Critical, and Hyperscale each provide different I/O, latency, and storage characteristics.

Compute Size: Measured in DTUs or vCores, determines the CPU, memory, and I/O capacity.

Intelligent Insights: Automatic tuning, query performance insights, and adaptive query processing help maintain optimal performance.

Performance Tuning Checklist

AreaRecommendationTool
IndexingCreate missing indexes & remove duplicatesQuery Performance Insight
StatisticsUpdate statistics regularlyAutomatic Statistics
Query DesignRewrite inefficient joins, avoid scalar UDFsSQL Profiler
Resource LimitsScale up/down based on DTU/vCore usageAzure Monitor
CacheLeverage result set caching and plan cachingIntelligent Performance

Sample Query Optimization

Consider the following example where a table scan is causing latency:

SELECT *
FROM Orders O
JOIN Customers C ON O.CustomerID = C.CustomerID
WHERE O.OrderDate > '2024-01-01'
  AND C.Region = 'North America';

Optimized version using proper indexing and filtered columns:

SELECT O.OrderID, O.OrderDate, C.Name, C.Region
FROM Orders O
JOIN Customers C ON O.CustomerID = C.CustomerID
WHERE O.OrderDate > '2024-01-01' AND C.Region = 'North America';

Ensure indexes exist on Orders(OrderDate, CustomerID) and Customers(Region, CustomerID).

Monitoring & Alerts

Set up alerts to notify when performance thresholds are crossed.

▶️ Example Alert Rule (Azure Monitor)
{
  "condition": {
    "metricName": "cpu_percent",
    "operator": "GreaterThan",
    "threshold": 80,
    "timeAggregation": "Average",
    "windowSize": "PT5M"
  },
  "action": {
    "type": "Email",
    "emailAddress": "ops@example.com"
  }
}