Skip to main content

Performance Monitoring & Tuning

Not sure which monitoring tool to use? See the Monitoring Tools Matrix for a complete comparison of Query Store, DMVs, Extended Events, and Azure-native tools.

The Monitoring Mental Model

Detect → Diagnose → Fix
🔍
1. Detect
Azure Portal Metrics (CPU%, DTU%)
Azure Monitor Alerts
Query Performance Insight
🩺
2. Diagnose
Query Store (plan regressions)
DMVs (wait stats, sessions)
Intelligent Insights (ML anomaly)
🛠️
3. Fix
Automatic Tuning (force plans)
Manual Index Tuning
Query Rewriting
Tier/Compute Scaling
🏢 Real-World DBA Note

Oracle DBA parallel: This is your OEM → AWR → ADDM → SQL Tuning Advisor flow, but in Azure. Portal Metrics = OEM dashboard. Query Store = AWR. Intelligent Insights = ADDM. Automatic Tuning = SQL Profiles applied automatically.

Key Monitoring Signals

MetricWhat It Tells YouOracle Equivalent
CPU %Query/index issuesCPU used by this session wait
Data IO %Storage bottleneck, missing indexesdb file sequential/scattered read
Log IO %Write-heavy workload, log rate limitlog file sync
DTU %Overall resource saturation (DTU model)Top-N AWR metrics combined
Sessions/Workers %Connection pool exhaustionv$session active count
DeadlocksConcurrent access conflictsORA-00060

Query Store — Your Flight Recorder

The most important tool for DP-300. Think of it as AWR on steroids — it captures per-query plans and stats continuously.

What Query Store Captures

DataRetentionOracle Equivalent
Query textUntil purgedV$SQL
Execution plans (all historical)ConfigurableDBA_HIST_SQL_PLAN
Runtime stats (CPU, duration, reads, rows)ConfigurableDBA_HIST_SQLSTAT
Wait statistics per queryConfigurableV$SESSION_WAIT + ASH
Plan forcing informationUntil removedSQL Profiles / SQL Baselines

Query Store Architecture

Query Store Architecture
Query Store Architecture
✈️
Flight Recorder
Captures every query text, execution plan, and runtime stats continuously
📊
Plan + Stats Storage
Stores all historical plans + CPU, duration, reads, rows per query. Configurable retention.
🔄
Plan Forcing
Force a specific plan when regression detected. FORCE_LAST_GOOD_PLAN auto-reverts bad plans.
🎯 Exam Focus

Query Store exam facts: 1) Enabled by default in Azure SQL DB. 2) Must be manually enabled on SQL Server/VM. 3) You can force a specific plan (like Oracle SQL Profiles). 4) It detects plan regressions automatically. 5) Stores data in the user database (not system DB).

The "Regressed Queries" Pattern (Exam Favorite)

  1. A query runs fine for months with Plan A
  2. Statistics update or schema change → optimizer picks Plan B
  3. Plan B is slower → performance regression
  4. Query Store detects this and can auto-force Plan A back

This is FORCE_LAST_GOOD_PLAN in Automatic Tuning — Azure's equivalent of Oracle's SQL Plan Baseline.

Dynamic Management Views (DMVs) — Cheat Sheet

What You NeedDMVOracle Equivalent
Currently running queriessys.dm_exec_requests + sys.dm_exec_sql_text()V$SESSION + V$SQL
Top queries by CPUsys.dm_exec_query_statsV$SQL ORDER BY CPU_TIME
Missing indexessys.dm_db_missing_index_*DBA_ADVISOR_RECOMMENDATIONS
Index fragmentationsys.dm_db_index_physical_stats()INDEX_STATS / ANALYZE INDEX VALIDATE
Wait statisticssys.dm_os_wait_statsV$SESSION_WAIT / ASH
Resource usage (last 1 hr)sys.dm_db_resource_statsV$SYSMETRIC
Active sessionssys.dm_exec_sessionsV$SESSION
Blocking chainssys.dm_exec_requests (blocking_session_id)V$LOCK + DBA_BLOCKERS
🎯 Exam Focus

Most-tested DMVs: sys.dm_db_resource_stats (resource utilization), sys.dm_exec_query_stats (query performance), sys.dm_db_missing_index_details (missing indexes), and sys.dm_db_index_physical_stats (fragmentation).

Index Tuning — Architecture & Strategy

Index Types

TypeArchitectureBest ForOracle Equivalent
ClusteredIS the table (data sorted by key)Primary key, range queriesIndex-Organized Table (IOT)
Non-clusteredSeparate B-tree with pointers to dataLookups, filtered queriesRegular B-tree index
ColumnstoreColumn-based storage, high compressionAnalytics, aggregationsNo direct equivalent (closest: bitmap)
FilteredNC index with WHERE clauseSparse data, status columnsFunction-based index (partial)

Index Maintenance Decision Tree

Index Maintenance Decision
🔍
Check Fragmentation
sys.dm_db_index_physical_stats()
Measure avg_fragmentation_in_percent
< 10%: No Action
Fragmentation is negligible
No maintenance needed
🔧
10-30%: REORGANIZE
Online operation, no locks
Lightweight defragmentation
🛠️
> 30%: REBUILD
Full rebuild of B-tree structure
Use ONLINE = ON in production
⚠️ Watch Out

REBUILD locks the table by default (offline). Always use ALTER INDEX ... REBUILD WITH (ONLINE = ON) in production. This requires Enterprise edition on VMs, but is always available in Azure SQL DB and MI (which include Enterprise features).

Columnstore — The Analytics Superpower

Columnstore vs Rowstore
📄
Rowstore (Traditional)
Stores entire rows together. Fast for point lookups + OLTP. SUM(Amount) reads ALL columns.
📊
Columnstore (Analytics)
Stores columns separately. SUM(Amount) reads ONLY that column. 10x compression, massive I/O savings.

Why columnstore is fast for analytics: SUM(Amount) only reads the Amount column (not entire rows). Compression can be 10x+, reducing I/O dramatically. Perfect for GROUP BY, SUM, AVG, COUNT on large datasets.

Automatic Tuning — Azure's Self-Healing

OptionWhat It DoesDefault
FORCE_LAST_GOOD_PLANDetects plan regression → forces previous good plan✅ On (Azure SQL DB)
CREATE_INDEXCreates missing indexes based on DMV recommendations❌ Off (opt-in)
DROP_INDEXDrops unused indexes wasting storage/write overhead❌ Off (opt-in)
🎯 Exam Focus

FORCE_LAST_GOOD_PLAN is the only automatic tuning option enabled by default. CREATE_INDEX and DROP_INDEX must be explicitly enabled. The exam tests whether you know which are on vs off by default.

Intelligent Insights

ML-based performance analysis that detects:

  • Timeout increasing — queries timing out more frequently
  • Waiting increasing — specific wait types growing
  • Regression — queries getting slower over time
  • Tempdb contention — excessive tempdb usage impacting performance

Results are written to a diagnostics log in JSON format → viewable in Azure Portal or Log Analytics.

🏢 Real-World DBA Note

Think of Intelligent Insights as ADDM that runs continuously. Oracle ADDM analyzes AWR snapshots hourly. Intelligent Insights analyzes Query Store + metrics continuously and proactively alerts on anomalies. No manual AWR report generation needed.


Flashcards

What is Query Store?
Click to reveal answer
A 'flight recorder' that captures query execution plans, runtime statistics, and history. Enables plan forcing and regression detection.
1 / 7

Quiz

Q1/4
0 correct
A query's execution plan suddenly changed and performance dropped. Which tool best diagnoses this?