SQL Server Interview Question #197
What are Dynamic Management Views (DMVs)?
Security, Backup, Recovery, Administration & Real-World Scenarios Senior Advanced
Detailed Explanation
Dynamic Management Views and Functions expose information about SQL Server state, workload, execution statistics, sessions, requests, indexes, memory, waits, and other engine activity.
Examples include sys.dm_exec_requests, sys.dm_exec_sessions, sys.dm_exec_query_stats, and sys.dm_db_index_usage_stats. DMV data is often transient and may reset after restart, failover, cache eviction, or other events, so it should be interpreted in context.
Code Example
SELECT session_id,
status,
command,
wait_type,
blocking_session_id
FROM sys.dm_exec_requests
WHERE session_id <> @@SPID;