Skip to main content

Azure SQL Database — Configuration & Resource Governance

Unlike SQL Server on VMs, Azure SQL Database is PaaS — Microsoft manages the OS, patching, and infrastructure. But you still control critical configuration settings that directly impact performance, cost, and behavior.

Resource Governance — How Azure Controls Your Workload

Azure SQL Database enforces resource limits at multiple levels. Understanding these is crucial for troubleshooting performance.

Resource Limits by Tier

ResourceGeneral Purpose (8 vCore)Business Critical (8 vCore)Hyperscale (8 vCore)
Max IOPS6,40048,000+Distributed (page servers)
Max log rate24 MB/s96 MB/s100 MB/s
Max concurrent workers800800800
Max concurrent sessions30,00030,00030,000
Max storage4 TB4 TB100 TB
tempdb sizeAuto-managedAuto-managedAuto-managed
Read replicas01 freeUp to 4 HA + 30 named
🎯 Exam Focus

Log rate governance is one of the most common bottlenecks in Azure SQL DB. If your log_write_percent metric stays at 100%, your workload is hitting the log rate limit. Solutions: scale up to more vCores, use BC tier (higher log rate), or optimize write patterns (batch inserts).

How to Detect Resource Governance Throttling

SymptomMetric to CheckWhat It Means
Slow writes/insertslog_write_percent = 100%Hitting log rate limit
Slow readsphysical_data_read_percent = 100%Hitting IOPS limit
Queries queueingworkers_percent > 80%Running out of worker threads
Connections refusedsessions_percent = 100%Session limit reached
General slownesscpu_percent > 80%Need more vCores
🏢 Real-World DBA Note

Oracle DBA parallel: Resource governance = Oracle Resource Manager profiles. The difference: in Oracle, you configure it. In Azure SQL DB, it's enforced automatically by the platform based on your tier/vCore count. You can't disable it — you can only scale up.

MAXDOP in Azure SQL Database

Unlike SQL Server on VMs where you set MAXDOP as a server property, Azure SQL DB has specific MAXDOP behavior:

SettingAzure SQL DBSQL MISQL on VM
Default MAXDOP0 (unlimited)00
ScopeDatabase-levelInstance-levelInstance-level
Change methodALTER DATABASE SCOPED CONFIGURATIONsp_configuresp_configure
Query-level overrideOPTION (MAXDOP n)OPTION (MAXDOP n)OPTION (MAXDOP n)
vCoresOLTPReporting/DWMixed
2-41-202
840 or 84
16+808
🎯 Exam Focus

In Azure SQL DB, MAXDOP is set using ALTER DATABASE SCOPED CONFIGURATION SET MAXDOP = n; — NOT sp_configure. This is a frequently tested difference from SQL Server on VM/MI.

tempdb in Azure SQL Database

You cannot directly configure tempdb in Azure SQL DB. Microsoft manages it automatically:

AspectAzure SQL DBSQL MI
tempdb locationLocal SSD (managed)Local SSD (managed)
Number of filesAuto-configured by serviceConfigurable
Max tempdb sizeVaries by tier/vCoresConfigurable
DBA controlNone (fully managed)Full control
tempdb contentionRare (well-tuned by platform)You manage
⚠️ Watch Out

If you're troubleshooting tempdb contention in Azure SQL DB, you cannot add tempdb files like you would on a VM. Instead, optimize your queries to reduce tempdb usage (avoid large sorts, reduce temp table usage, use table variables cautiously).

Compatibility Level

The compatibility level determines which query optimizer behaviors are available:

Compat LevelSQL VersionKey Features Enabled
160SQL 2022Parameter Sensitivity Plan, CE 2022 feedback, DOP feedback
150SQL 2019Batch mode on rowstore, memory grant feedback, adaptive joins, scalar inlining
140SQL 2017Interleaved execution, adaptive query processing
130SQL 2016Batch mode for columnstore, new CE improvements
120SQL 2014New Cardinality Estimator (CE)
110SQL 2012Legacy CE
🎯 Exam Focus

DP-300 critical: Changing compatibility level changes the query optimizer behavior, not the SQL engine version. A SQL 2022 database at compat 130 uses the SQL 2016 optimizer — it can run SQL 2022 T-SQL syntax but optimizes differently. When migrating, keep the old compat level first to avoid plan regressions, then upgrade gradually.

Safe Migration Pattern for Compatibility Level

  1. Keep old compat level after migration → queries use familiar optimizer
  2. Enable Query Store → captures baseline plans at old compat level
  3. Upgrade compat level → new optimizer may choose different plans
  4. Monitor Query Store for regressions → force old good plans if needed
  5. Use FORCE_LAST_GOOD_PLAN → automatic regression protection

Automatic Tuning

Azure SQL Database can automatically tune your workload:

FeatureWhat It DoesEnabled by Default?
Force Last Good PlanDetects plan regressions, auto-forces previous good plan✅ Yes (Azure SQL DB)
Create IndexIdentifies missing indexes from DMVs, auto-creates❌ Off by default
Drop IndexDetects unused/duplicate indexes, auto-drops❌ Off by default
⚠️ Watch Out

Create Index and Drop Index auto-tuning should be tested carefully before enabling in production. Auto-created indexes can hurt write performance, and auto-dropped indexes might be needed for less-frequent queries. Always review the recommendations first in the Azure Portal before enabling auto-actions.

Intelligent Query Processing (IQP)

IQP features are activated by compatibility level, not by a setting you enable:

Key IQP Features (Compat 150+)

FeatureWhat It DoesExam Importance
Batch Mode on RowstoreUses batch processing even without columnstore indexesHigh
Memory Grant FeedbackAdjusts memory grants based on actual vs estimated usageHigh
Adaptive JoinsSwitches between hash and nested loop at runtimeHigh
Table Variable Deferred CompilationCorrect row count for table variables (no longer assumes 1 row)Medium
Scalar UDF InliningInlines simple scalar functions into the query planMedium
Interleaved ExecutionExecutes multi-statement TVFs, then reoptimizesMedium

Key IQP Features (Compat 160 — SQL 2022)

FeatureWhat It Does
Parameter Sensitivity Plan (PSP)Creates multiple plan variants for different parameter values
Cardinality Estimation FeedbackAdjusts CE based on actual vs estimated rows
DOP FeedbackOptimizes parallelism degree based on runtime metrics
Optimized Plan ForcingReduces time to force plans from Query Store
🎯 Exam Focus

Batch Mode on Rowstore is the most heavily tested IQP feature on DP-300. It enables batch processing (processing 900 rows at a time instead of row-by-row) for rowstore tables — previously only available with columnstore indexes. Available at compat 150+.

🏢 Real-World DBA Note

Oracle DBA parallel: IQP features = Oracle Adaptive Query Optimization (adaptive plans, adaptive statistics, SQL plan directives). Both databases now automatically adjust execution strategies based on runtime feedback — Azure SQL calls it IQP, Oracle calls it Adaptive SQL Plan Management.

Serverless Compute Tier

Azure SQL DB Serverless auto-scales vCores and can auto-pause:

SettingDetail
Min vCores0.5 - 40+ (set your floor)
Max vCores1 - 80+ (set your ceiling)
Auto-pause delayMinimum 60 minutes of inactivity
Wake-up time~1 minute on first connection after pause
BillingPer-second for vCores used + storage
StorageBilled even when paused

When to use Serverless:

  • Dev/test environments
  • Databases with intermittent, unpredictable usage
  • Applications tolerant of ~1 minute cold start

When NOT to use Serverless:

  • Steady-state production OLTP
  • Latency-sensitive applications
  • Workloads that never go idle

Elastic Pools — Resource Sharing

Multiple databases sharing a pool of vCores or DTUs:

AspectDetail
When to useMulti-tenant SaaS, databases with complementary usage patterns
PricingPay for pool resources, not per-database
Rule of thumb1.5x eDTUs × DB count < sum of individual DTUs = pool saves money
Per-DB limitsSet min/max resources per database within the pool
MonitoringPool-level and per-DB metrics in Azure Monitor
🎯 Exam Focus

Elastic Pools are cost-effective when databases have spiky, non-overlapping usage patterns. If all databases peak at the same time, a pool doesn't help — you need the same total peak capacity regardless.

Configuration Comparison: SQL DB vs MI vs VM

Config ItemAzure SQL DBSQL MISQL on VM
MAXDOPDB scoped configsp_configuresp_configure
Max MemoryManagedManagedYou configure
tempdbFully managedYou configureYou configure
Compatibility LevelYou setYou setYou set
Query StoreON by defaultON by defaultYou enable
Automated BackupsAutomaticAutomaticYou configure
PatchingAutomaticAutomaticYou manage
StorageManagedManagedYou configure
IFIN/AN/AYou enable
Lock Pages in MemoryN/AN/AYou enable
Trace FlagsNot supportedLimitedFull control

Flashcards

How do you set MAXDOP in Azure SQL Database?
Click to reveal answer
ALTER DATABASE SCOPED CONFIGURATION SET MAXDOP = n; — NOT sp_configure (that's for MI/VM only).
1 / 8

Quiz

Q1/5
0 correct
Your Azure SQL DB has log_write_percent consistently at 100%. Users report slow insert performance. What should you do?