🔒 Guided

Pre-launch preview. Authorised access only.

Incorrect code

Guided by A Guide to Cloud
Explore AB-900 AI-901
Guided DP-300 Domain 3
Domain 3 — Module 4 of 7 57%
15 of 28 overall

DP-300 Study Guide

Domain 1: Plan and Implement Data Platform Resources

  • Choose Your Azure SQL Platform Free
  • Deploy and Configure Azure SQL Free
  • Scale, Performance, and Compression Free
  • Migration Planning: Online vs Offline Free
  • Execute and Troubleshoot Migrations Free

Domain 2: Implement a Secure Environment

  • Entra Authentication for Azure SQL
  • Security Principals, Permissions, and T-SQL
  • Encryption: TDE, Always Encrypted, and VBS Enclaves
  • Network Security: Firewalls, Private Links, and Endpoints
  • Data Classification and Auditing
  • Data Masking, Ledger, and Row-Level Security

Domain 3: Monitor, Configure, and Optimize Database Resources

  • Performance Baselines and Monitoring Tools
  • Database Watcher and Extended Events
  • Query Store: Configure and Monitor
  • Blocking, DMVs, and Execution Plans
  • Index and Query Optimization
  • Database Maintenance: Indexes, Statistics, and Integrity
  • Automatic Tuning and Performance Settings

Domain 4: Configure and Manage Automation of Tasks

  • Automation Landscape: What Runs Where
  • SQL Server Agent Jobs
  • Deploy with ARM, Bicep, PowerShell, and CLI
  • Elastic Jobs and Azure Automation

Domain 5: Plan and Configure an HA/DR Environment

  • HA/DR Strategy: RPO, RTO, and Architecture
  • Backup and Restore: Strategy and Native Tools
  • Point-in-Time Restore, LTR, and Cloud Backup
  • Geo-Replication and Failover Groups
  • Always On: Availability Groups and FCIs
  • Log Shipping and HA/DR Operations

DP-300 Study Guide

Domain 1: Plan and Implement Data Platform Resources

  • Choose Your Azure SQL Platform Free
  • Deploy and Configure Azure SQL Free
  • Scale, Performance, and Compression Free
  • Migration Planning: Online vs Offline Free
  • Execute and Troubleshoot Migrations Free

Domain 2: Implement a Secure Environment

  • Entra Authentication for Azure SQL
  • Security Principals, Permissions, and T-SQL
  • Encryption: TDE, Always Encrypted, and VBS Enclaves
  • Network Security: Firewalls, Private Links, and Endpoints
  • Data Classification and Auditing
  • Data Masking, Ledger, and Row-Level Security

Domain 3: Monitor, Configure, and Optimize Database Resources

  • Performance Baselines and Monitoring Tools
  • Database Watcher and Extended Events
  • Query Store: Configure and Monitor
  • Blocking, DMVs, and Execution Plans
  • Index and Query Optimization
  • Database Maintenance: Indexes, Statistics, and Integrity
  • Automatic Tuning and Performance Settings

Domain 4: Configure and Manage Automation of Tasks

  • Automation Landscape: What Runs Where
  • SQL Server Agent Jobs
  • Deploy with ARM, Bicep, PowerShell, and CLI
  • Elastic Jobs and Azure Automation

Domain 5: Plan and Configure an HA/DR Environment

  • HA/DR Strategy: RPO, RTO, and Architecture
  • Backup and Restore: Strategy and Native Tools
  • Point-in-Time Restore, LTR, and Cloud Backup
  • Geo-Replication and Failover Groups
  • Always On: Availability Groups and FCIs
  • Log Shipping and HA/DR Operations
Domain 3: Monitor, Configure, and Optimize Database Resources Premium ⏱ ~14 min read

Blocking, DMVs, and Execution Plans

Identify and resolve session blocking, use dynamic management views for performance diagnostics, review execution plans, and monitor with Intelligent Insights.

Diagnosing performance problems

☕ Simple explanation

Blocking is like a traffic jam — one car (session) stops in the middle of the road, and everyone behind it waits. Find the car causing the jam, move it, and traffic flows again.

DMVs are your traffic cameras — they show you live data about what every session is doing, what it’s waiting for, and how much resource it’s using.

Execution plans are the GPS route the database chose for your query. Sometimes it picks a bad route (full table scan instead of an index seek). Reading the plan tells you why a query is slow.

Performance diagnostics in SQL Server rely on three core skills: identifying blocking chains, querying DMVs for real-time state, and interpreting execution plans to understand query optimiser decisions.

Session blocking

Blocking occurs when one session holds a lock that another session needs. It’s normal and temporary in most cases — problematic when it lasts.

Finding blocking chains

-- Find blocked sessions and their blockers
SELECT
    blocked.session_id AS blocked_session,
    blocked.blocking_session_id AS blocker_session,
    blocked.wait_type,
    blocked.wait_time / 1000.0 AS wait_seconds,
    blocker_text.text AS blocker_query,
    blocked_text.text AS blocked_query
FROM sys.dm_exec_requests blocked
CROSS APPLY sys.dm_exec_sql_text(blocked.sql_handle) blocked_text
LEFT JOIN sys.dm_exec_requests blocker ON blocked.blocking_session_id = blocker.session_id
OUTER APPLY sys.dm_exec_sql_text(blocker.sql_handle) blocker_text
WHERE blocked.blocking_session_id <> 0;

Resolving blocking

StrategyWhen to Use
Wait it outShort blocks (under 10 seconds) during normal operations
Kill the blockerThe blocking session is stuck or abandoned (KILL session_id)
Optimise the blockerThe blocking query is inefficient — make it faster (better indexes, smaller transactions)
Use RCSIEnable Read Committed Snapshot Isolation to reduce reader-writer blocking
Shorter transactionsKeep transactions as brief as possible — don’t hold locks while waiting for user input
Appropriate isolation levelUse READ COMMITTED (default) or SNAPSHOT instead of SERIALIZABLE unless needed
ℹ️ RCSI — the blocking killer

Read Committed Snapshot Isolation (RCSI) changes how readers and writers interact:

  • Without RCSI: Readers block on writers (wait for locks to release)
  • With RCSI: Readers get a consistent snapshot from tempdb — no waiting
ALTER DATABASE NorthStarERP SET READ_COMMITTED_SNAPSHOT ON;

RCSI is enabled by default on Azure SQL Database. On MI and SQL VMs, you enable it manually. The trade-off: increased tempdb usage for version store.

Essential DMVs

DMVWhat It ShowsUse Case
sys.dm_exec_requestsCurrently executing requestsFind active queries, blocking, wait types
sys.dm_exec_sessionsAll active sessionsSession count, login info, memory usage
sys.dm_exec_query_statsAggregated query statisticsTop queries by CPU, reads, duration
sys.dm_os_wait_statsServer-wide wait statisticsIdentify top waits (I/O, locks, CPU)
sys.dm_db_index_usage_statsIndex read/write/seek countsFind unused or missing indexes
sys.dm_db_missing_index_detailsSuggested missing indexesIndex recommendations with impact
sys.dm_exec_cached_plansCached execution plansPlan cache analysis, plan reuse
sys.dm_db_resource_statsResource utilisation (SQL DB)CPU, I/O, memory over time
sys.dm_tran_locksCurrent lock informationLock analysis during blocking

Practical DMV queries

-- Top 10 queries by average CPU time
SELECT TOP 10
    qs.total_worker_time / qs.execution_count AS avg_cpu_us,
    qs.execution_count,
    qs.total_logical_reads / qs.execution_count AS avg_reads,
    SUBSTRING(st.text, (qs.statement_start_offset/2)+1, 200) AS query_text
FROM sys.dm_exec_query_stats qs
CROSS APPLY sys.dm_exec_sql_text(qs.sql_handle) st
ORDER BY avg_cpu_us DESC;

-- Missing index recommendations
SELECT
    mid.statement AS table_name,
    mid.equality_columns,
    mid.inequality_columns,
    mid.included_columns,
    migs.avg_user_impact AS estimated_improvement_pct,
    migs.user_seeks
FROM sys.dm_db_missing_index_details mid
JOIN sys.dm_db_missing_index_groups mig ON mid.index_handle = mig.index_handle
JOIN sys.dm_db_missing_index_group_stats migs ON mig.index_group_handle = migs.group_handle
ORDER BY migs.avg_user_impact * migs.user_seeks DESC;

Execution plans

An execution plan shows the exact steps the query optimizer chose to execute your query.

How to get a plan

MethodT-SQLNotes
Estimated planSET SHOWPLAN_XML ONShows what the optimizer PLANS to do (without executing)
Actual planSET STATISTICS XML ONShows what actually happened (with row counts, execution times)
SSMSCtrl+L (estimated), Ctrl+M (actual)Visual plan diagram

Key operators to know

OperatorWhat It MeansGood or Bad?
Index SeekTargeted lookup using an indexGood — efficient
Index ScanReads entire indexBad if table is large
Clustered Index ScanFull table scanUsually bad — no useful index
Key LookupFetches additional columns not in the indexOK if few rows, bad if many
Nested LoopRow-by-row joinGood for small result sets
Hash MatchHash-based joinGood for large unsorted sets
SortSorts data in memory/tempdbExpensive if unexpected or large
Table SpoolCaches intermediate resultsWatch for unnecessary spools

Reading plan properties

  • Estimated vs Actual Rows: A big difference means stale statistics
  • Cost %: Higher percentage = more expensive step
  • Warnings: Yellow triangles indicate problems (missing indexes, implicit conversions)
💡 Exam tip: implicit conversions

A common plan warning is implicit conversion — the optimizer converts a column’s data type to match a parameter. This can:

  • Prevent index seeks (scan instead)
  • Waste CPU on type conversion
  • Cause wrong row estimates

Example: WHERE VarcharColumn = @NVarcharParam — the optimizer converts every row’s VarcharColumn to NVARCHAR, causing a scan.

Fix: Match parameter types to column types in application code.

Intelligent Insights

Intelligent Insights is an Azure SQL Database and MI feature that uses built-in intelligence to detect performance issues:

  • Automatically detects: query regressions, timeout increases, excessive wait times, resource limits
  • Provides root cause analysis and recommended actions
  • Outputs diagnostics to a JSON log (send to Log Analytics for querying)
  • Part of Azure SQL’s diagnostic settings (enable the “SQLInsights” category)
Insight TypeWhat It Detects
Reaching resource limitsCPU, I/O, or storage hitting platform limits
Workload increaseMore queries or heavier queries than baseline
Memory pressureInsufficient memory for query execution
LockingExcessive blocking affecting performance
Plan regressionOptimizer chose a worse plan (similar to Query Store)
Database-scoped config changeA config change impacted performance
Question

What DMV shows you currently blocked sessions and what they're waiting for?

Click or press Enter to reveal answer

Answer

sys.dm_exec_requests — filter on blocking_session_id <> 0. Shows the blocked session, its blocker, wait type, wait duration, and the SQL text of both queries.

Click to flip back

Question

What does RCSI (Read Committed Snapshot Isolation) do?

Click or press Enter to reveal answer

Answer

Readers get a consistent snapshot from the version store (tempdb) instead of waiting for writers to release locks. Eliminates reader-writer blocking. Enabled by default on Azure SQL Database.

Click to flip back

Question

In an execution plan, what does a big difference between Estimated Rows and Actual Rows indicate?

Click or press Enter to reveal answer

Answer

Stale or inaccurate statistics. The optimizer made a bad plan choice because its row estimates were wrong. Fix: UPDATE STATISTICS on the involved tables.

Click to flip back

Knowledge Check

Tomas sees multiple sessions waiting with LCK_M_S waits for over 30 seconds. All are blocked by session 55, which is running an UPDATE inside an uncommitted transaction. What should he do first?

Knowledge Check

Kenji reviews an execution plan and sees a Clustered Index Scan with 5 million rows returned but the query only needs 10 rows. The WHERE clause uses an NVARCHAR parameter against a VARCHAR column. What is the likely cause?

🎬 Video coming soon

Next up: Index and Query Optimization — identify the right indexes and optimise query constructs.

← Previous

Query Store: Configure and Monitor

Next →

Index and Query Optimization

Guided

I learn, I simplify, I share.

A Guide to Cloud YouTube Feedback

© 2026 Sutheesh. All rights reserved.

Guided is an independent study resource and is not affiliated with, endorsed by, or officially connected to Microsoft. Microsoft, Azure, and related trademarks are property of Microsoft Corporation. Always verify information against Microsoft Learn.