Dynamic Management Views — Chapter Reference

How to use this page

  • Quick lookup: the index table below lists every DMV with its category, purpose, and source pages.
  • Full reference: scroll to the category section or use Ctrl+F to find a specific DMV name.
  • Cross-references: each entry links to every vault page where the DMV appears with a live query or detailed explanation.

Quick-Lookup Index

Source page legend — abbreviated codes map to page numbers within each subfolder:

SO (Server Operations): 01 config · 02 sqlcmd · 03 auth · 04 roles · 05 agent · 06 dba-queries · 07 backup · 08 restore · 09 ha-overview · 10 always-on · 11 memory · 12 audit · 13 tde · 14 problems · 15 flowcharts · 16 perf-audit · 17 finops

DDS (Database Design and Storage): 01 file-layout · 02 internals · 03 schemas · 04 keys · 05 schema-layering · 06 index-types · 07 index-maint · 08 compression · 09 partitioning · 10 change-tracking

QWO (Query Writing and Optimization): 02 data-types · 04 ctes · 05 windows · 07 strings · 08 datetime · 09 json-xml · 10 insert-update-delete · 11 merge · 12 sargable · 13 exec-plans · 14 wait-stats · 15 sys-functions · 16 blocking · 17 deadlocks · 18 race-conditions · 19 stored-procs · 20 query-store

APP (Applied Pipelines): 01 loading · 02 bronze · 03 silver · 04 gold · 05 incremental · 06 pit-integrity · 07 devex · 08 anti-patterns

DMVCategoryPurposeSource Pages
sys.dm_exec_requestsExecutionCurrently executing request stateSO:06,08,14,15,16 · DDS:04 · QWO:13,14,15,16
sys.dm_exec_sessionsExecutionAuthenticated session detailsSO:02,03,06,11,16 · DDS:06 · QWO:13,15,16,18 · APP:07
sys.dm_exec_query_statsExecutionAggregate performance stats for cached plansSO:06,11,14,16 · DDS:06 · QWO:13
sys.dm_exec_sql_textExecutionSQL text for a given sql_handleSO:06,11,14,15,16 · DDS:06 · QWO:15,16 · APP:07
sys.dm_exec_query_planExecutionShowplan XML for a cached planSO:14,16 · DDS:06 · QWO:13
sys.dm_exec_cached_plansExecutionAll plans in the plan cacheSO:11,16,17 · APP:07
sys.dm_exec_connectionsExecutionPhysical connection detailsSO:02,03 · QWO:15
sys.dm_exec_query_memory_grantsExecutionQueries holding or waiting for memory grantsSO:11,16
sys.dm_exec_plan_attributesExecutionPlan cache entry attributesSO:16
sys.dm_exec_query_optimizer_memory_gatewaysExecutionConcurrent query optimization memorySO:11
sys.dm_exec_query_resource_semaphoresExecutionQuery memory grant semaphore stateSO:11
sys.dm_exec_query_plan_statsExecutionLast known actual execution planQWO:13
sys.dm_exec_query_statistics_xmlExecutionIn-flight runtime statistics as XMLQWO:13
sys.dm_os_wait_statsOS / MemoryAggregate wait statistics since startupSO:06,09,10,11,14,15,16,17 · DDS:01 · QWO:13,14,16
sys.dm_os_sys_infoOS / MemoryServer-level hardware and config infoSO:01,06,11,16,17 · DDS:07 · QWO:13,14,15
sys.dm_os_memory_clerksOS / MemoryActive memory clerk allocationsSO:11,16,17
sys.dm_os_performance_countersOS / MemorySQL Server performance counter valuesSO:11,16 · QWO:14,15
sys.dm_os_buffer_descriptorsOS / MemoryBuffer pool page inventorySO:11,16
sys.dm_os_process_memoryOS / MemorySQL Server process memory from OS perspectiveSO:11,17
sys.dm_os_sys_memoryOS / MemorySystem-wide physical memory stateSO:11,17
sys.dm_os_volume_statsOS / MemoryOS volume I/O statisticsSO:15,17 · QWO:14
sys.dm_os_memory_cache_countersOS / MemoryCache health snapshotSO:11
sys.dm_os_ring_buffersOS / MemoryInternal ring buffer recordsQWO:15
sys.dm_os_workersOS / MemoryWorker thread stateQWO:15
sys.dm_db_index_physical_statsIndexesIndex size and fragmentationSO:06,14,16 · DDS:01,02,03,04,06,07
sys.dm_db_index_operational_statsIndexesPer-index I/O, locking, latching activitySO:15 · DDS:02,06,07,08 · QWO:16
sys.dm_db_index_usage_statsIndexesIndex operation counts by typeSO:15,17 · DDS:06,07 · QWO:09,11,12,15
sys.dm_db_missing_index_detailsIndexesMissing index column recommendationsSO:06,15 · DDS:06,07 · QWO:13
sys.dm_db_missing_index_group_statsIndexesMissing index group impact statsSO:06,15 · DDS:06,07
sys.dm_db_missing_index_groupsIndexesMissing index group membershipSO:06,15 · DDS:06,07
sys.dm_io_virtual_file_statsFiles / SpaceData and log file I/O statisticsSO:06,14,16 · QWO:14,15
sys.dm_db_log_space_usageFiles / SpaceTransaction log space consumptionSO:06,14,17 · DDS:01,02,03
sys.dm_db_log_infoFiles / SpaceVirtual log file (VLF) detailsSO:08,16,17 · DDS:01,02
sys.dm_db_file_space_usageFiles / SpaceData file space breakdownSO:15,16 · DDS:02
sys.dm_db_log_statsFiles / SpaceTransaction log summary statisticsDDS:02
sys.dm_db_database_page_allocationsFiles / SpacePer-page allocation mapDDS:02
sys.dm_db_page_infoFiles / SpaceSingle-page metadata lookupDDS:02
sys.dm_db_partition_statsStatisticsPartition-level page and row countsSO:06 · DDS:08,09
sys.dm_db_stats_propertiesStatisticsStatistics object properties and stalenessSO:14,16 · DDS:07
sys.dm_db_column_store_row_group_physical_statsStatisticsColumnstore rowgroup healthSO:16 · DDS:03,06,07
sys.dm_db_persisted_sku_featuresStatisticsEdition-locked features in useSO:17
sys.dm_db_xtp_hash_index_statsStatisticsIn-Memory OLTP hash index statsDDS:03
sys.dm_os_waiting_tasksTransactionsTasks currently waiting on a resourceSO:06,14,15 · QWO:16
sys.dm_tran_active_transactionsTransactionsCurrently active transactionsSO:06,07,14,16 · QWO:15
sys.dm_tran_locksTransactionsCurrently held lock resourcesSO:15 · QWO:16,18
sys.dm_tran_session_transactionsTransactionsSession-to-transaction correlationSO:06,14 · QWO:15
sys.dm_tran_database_transactionsTransactionsDatabase-level transaction stateSO:06,16
sys.dm_tran_version_storeTransactionsTempdb version store recordsSO:11
sys.dm_tran_version_store_space_usageTransactionsVersion store space per databaseSO:14,16 · DDS:01
sys.dm_hadr_database_replica_statesHADRAG database replica healthSO:09,10,14,15
sys.dm_hadr_availability_replica_statesHADRAG replica connection and sync stateSO:09,10
sys.dm_hadr_clusterHADRWSFC cluster-level infoSO:09
sys.dm_hadr_cluster_membersHADRCluster node membership and stateSO:09
sys.dm_hadr_automatic_seedingHADRAutomatic seeding progressSO:09,10
sys.dm_xe_sessionsAudit / XEActive Extended Event sessionsSO:14,15,16 · QWO:17
sys.dm_xe_session_targetsAudit / XEXE session target configurationSO:14,15,16 · QWO:17
sys.dm_audit_actionsAudit / XEAll audit action definitionsSO:12
sys.dm_audit_class_type_mapAudit / XEAudit class type mappingsSO:12
sys.dm_server_audit_statusAudit / XECurrent server audit stateSO:12
sys.dm_database_encryption_keysServer StateDatabase encryption key stateSO:13,14
sys.dm_server_servicesServer StateSQL Server service informationDDS:01
sys.dm_server_suspend_statusServer StateServer suspend stateSO:17
sys.dm_cdc_errorsServer StateCDC log scan errorsDDS:10

Execution and Query Runtime

SQL Server | sys.dm_exec_requests | currently executing request state

Scope: server-wide · Permissions: VIEW SERVER STATE · Resets: instance restart Used in: essential-dba-queries · restore-and-recovery · sql-server-problems · troubleshooting-flowcharts · performance-audit-playbook · keys-defaults-identity-and-sequences · execution-plans · wait-stats-analysis · system-functions-and-session-metadata · blocking-and-locking

Returns one row per currently executing request. The primary DMV for real-time session monitoring, blocking analysis, and wait diagnostics. Cross-apply with sys.dm_exec_sql_text(sql_handle) to resolve the executing statement and sys.dm_exec_query_plan(plan_handle) to retrieve the cached plan.


SQL Server | sys.dm_exec_sessions | authenticated session details

Scope: server-wide · Permissions: VIEW SERVER STATE · Resets: instance restart Used in: sqlcmd-connection-and-usage · sql-server-authentication · essential-dba-queries · memory-and-buffer-pool · performance-audit-playbook · index-types-and-strategy · execution-plans · system-functions-and-session-metadata · blocking-and-locking · race-conditions · pipeline-integration-and-devex

Returns one row per authenticated session on the instance, including both user and system sessions. The most-referenced DMV in the chapter — it provides the identity, resource usage, and status baseline for every connected SPID.


SQL Server | sys.dm_exec_query_stats | aggregate performance statistics for cached plans

Scope: server-wide · Permissions: VIEW SERVER STATE · Resets: instance restart or plan eviction Used in: essential-dba-queries · memory-and-buffer-pool · sql-server-problems · performance-audit-playbook · index-types-and-strategy · execution-plans

Returns one row per statement within a cached plan, with aggregate execution metrics since the plan was compiled. The primary DMV for identifying expensive queries, regression detection, and resource-consumption ranking. Cross-apply with sys.dm_exec_sql_text(sql_handle) and sys.dm_exec_query_plan(plan_handle) to resolve text and plan XML.


SQL Server | sys.dm_exec_sql_text | SQL batch text retrieval

Scope: server-wide · Permissions: VIEW SERVER STATE · Type: table-valued function Used in: essential-dba-queries · memory-and-buffer-pool · sql-server-problems · troubleshooting-flowcharts · performance-audit-playbook · index-types-and-strategy · system-functions-and-session-metadata · blocking-and-locking · pipeline-integration-and-devex

Table-valued function invoked as CROSS APPLY sys.dm_exec_sql_text(sql_handle). Returns the full SQL text of a batch, stored procedure, or trigger identified by sql_handle.


SQL Server | sys.dm_exec_query_plan | cached execution plan XML

Scope: server-wide · Permissions: SHOWPLAN · Type: table-valued function Used in: sql-server-problems · performance-audit-playbook · index-types-and-strategy · execution-plans

Table-valued function invoked as CROSS APPLY sys.dm_exec_query_plan(plan_handle). Returns the showplan XML for an entire cached batch. For statement-level plans, use sys.dm_exec_text_query_plan instead.


SQL Server | sys.dm_exec_cached_plans | plan cache inventory

Scope: server-wide · Permissions: VIEW SERVER STATE · Resets: instance restart or manual DBCC FREEPROCCACHE Used in: memory-and-buffer-pool · performance-audit-playbook · finops-cost-optimization · pipeline-integration-and-devex

Returns one row per cached plan entry. Used to audit plan cache size, detect single-use plan bloat, and identify forced plans. Join to sys.dm_exec_query_stats on plan_handle for per-statement metrics.


SQL Server | sys.dm_exec_connections | physical connection details

Scope: server-wide · Permissions: VIEW SERVER STATE Used in: sqlcmd-connection-and-usage · sql-server-authentication · system-functions-and-session-metadata

Returns one row per physical connection. Joins to sys.dm_exec_sessions on session_id. Provides transport-layer details including protocol, encryption, and network packet sizes.


SQL Server | sys.dm_exec_query_memory_grants | memory grant queue and allocation

Scope: server-wide · Permissions: VIEW SERVER STATE Used in: memory-and-buffer-pool · performance-audit-playbook

Returns one row per query that has acquired a memory grant or is waiting for one. Key DMV for diagnosing RESOURCE_SEMAPHORE waits and memory grant feedback issues.


SQL Server | sys.dm_exec_plan_attributes | plan cache entry metadata

Scope: server-wide · Permissions: VIEW SERVER STATE · Type: table-valued function Used in: performance-audit-playbook

Table-valued function invoked as CROSS APPLY sys.dm_exec_plan_attributes(plan_handle). Returns one row per attribute of a cached plan entry, including dbid, objectid, set_options, and user_id. Used to determine why two seemingly identical queries compiled into separate plan cache entries.


SQL Server | sys.dm_exec_query_optimizer_memory_gateways | optimizer memory concurrency

Scope: server-wide · Permissions: VIEW SERVER STATE Used in: memory-and-buffer-pool

Returns the current status of resource semaphores used to throttle concurrent query optimization. Each gateway limits how many compilations can proceed simultaneously to prevent optimizer memory exhaustion.


SQL Server | sys.dm_exec_query_resource_semaphores | memory grant semaphore state

Scope: server-wide · Permissions: VIEW SERVER STATE Used in: memory-and-buffer-pool

Returns the current resource semaphore state for each Resource Governor resource pool. Two semaphores per pool: one for regular queries, one for small queries. Diagnoses whether queries are being throttled on memory grants.


SQL Server | sys.dm_exec_query_plan_stats | last known actual execution plan

Scope: server-wide · Permissions: VIEW SERVER STATE · Type: table-valued function Used in: execution-plans

Table-valued function returning the last known actual execution plan equivalent for a previously executed query. Requires LAST_QUERY_PLAN_STATS database-scoped configuration to be enabled, or the QUERY_PLAN_PROFILE Extended Event / query_post_execution_plan_profile lightweight profiling to be active.


SQL Server | sys.dm_exec_query_statistics_xml | in-flight runtime statistics

Scope: server-wide · Permissions: VIEW SERVER STATE · Type: table-valued function Used in: execution-plans

Table-valued function invoked as CROSS APPLY sys.dm_exec_query_statistics_xml(session_id). Returns the in-flight actual execution plan for a currently running query. Lightweight profiling infrastructure must be active (enabled by default in SQL Server 2019+).


OS and Memory

SQL Server | sys.dm_os_wait_stats | aggregate wait statistics since startup

Scope: server-wide · Permissions: VIEW SERVER STATE · Resets: instance restart or DBCC SQLPERF('sys.dm_os_wait_stats', CLEAR) Used in: essential-dba-queries · high-availability-overview · always-on-availability-groups · memory-and-buffer-pool · sql-server-problems · troubleshooting-flowcharts · performance-audit-playbook · finops-cost-optimization · database-creation-and-file-layout · execution-plans · wait-stats-analysis · blocking-and-locking

Returns one row per wait type with cumulative wait counts and durations since the last reset. The foundation of wait-based performance tuning methodology. Filter out benign background waits (BROKER_TASK_STOP, CLR_SEMAPHORE, LAZYWRITER_SLEEP, SLEEP_TASK, WAITFOR, etc.) to surface actionable wait types.


SQL Server | sys.dm_os_sys_info | server-level hardware and configuration

Scope: server-wide · Permissions: VIEW SERVER STATE · Resets: instance restart Used in: server-configuration · essential-dba-queries · memory-and-buffer-pool · performance-audit-playbook · finops-cost-optimization · index-maintenance · execution-plans · wait-stats-analysis · system-functions-and-session-metadata

Returns a single row with instance-level hardware visibility: CPU count, memory, scheduler count, and startup time. Used as a baseline denominator for per-core or per-GB metrics.


SQL Server | sys.dm_os_memory_clerks | memory clerk allocation breakdown

Scope: server-wide · Permissions: VIEW SERVER STATE · Resets: instance restart Used in: memory-and-buffer-pool · performance-audit-playbook · finops-cost-optimization

Returns one row per memory clerk with its current allocation. Memory clerks are the internal consumers that request pages from the buffer pool or memory nodes. The top consumers by pages_kb reveal where memory is going — MEMORYCLERK_SQLBUFFERPOOL (buffer pool), CACHESTORE_SQLCP (plan cache), OBJECTSTORE_LOCK_MANAGER (lock memory), etc.


SQL Server | sys.dm_os_performance_counters | SQL Server performance counter values

Scope: server-wide · Permissions: VIEW SERVER STATE Used in: memory-and-buffer-pool · performance-audit-playbook · wait-stats-analysis · system-functions-and-session-metadata

Returns one row per performance counter exposed by SQL Server. Counter semantics depend on cntr_type — raw values, per-second rates, or ratios requiring a base counter.


SQL Server | sys.dm_os_buffer_descriptors | buffer pool page inventory

Scope: server-wide · Permissions: VIEW SERVER STATE Used in: memory-and-buffer-pool · performance-audit-playbook

Returns one row per data page currently in the buffer pool. Aggregate by database_id and allocation_unit_id to determine which databases and tables consume the most buffer pool memory. Expensive on large buffer pools — snapshot can take seconds on instances with hundreds of GB of memory.


SQL Server | sys.dm_os_process_memory | SQL Server process memory from OS

Scope: server-wide · Permissions: VIEW SERVER STATE Used in: memory-and-buffer-pool · finops-cost-optimization

Returns the process-level memory state from the OS perspective. Complements dm_os_sys_memory (system-wide) and dm_os_memory_clerks (internal breakdown).


SQL Server | sys.dm_os_sys_memory | system-wide physical memory state

Scope: server-wide · Permissions: VIEW SERVER STATE Used in: memory-and-buffer-pool · finops-cost-optimization

Returns a single row reflecting the OS-reported memory state. Distinct from dm_os_process_memory (SQL Server process only) and dm_os_sys_info (hardware topology).


SQL Server | sys.dm_os_volume_stats | OS volume I/O statistics

Scope: database-level · Permissions: VIEW SERVER STATE · Type: table-valued function Used in: troubleshooting-flowcharts · finops-cost-optimization · wait-stats-analysis

Table-valued function invoked as CROSS APPLY sys.dm_os_volume_stats(database_id, file_id). Returns OS-level volume information for the drive hosting a database file. Used to check disk free space and volume configuration.


SQL Server | sys.dm_os_memory_cache_counters | cache health snapshot

Scope: server-wide · Permissions: VIEW SERVER STATE Used in: memory-and-buffer-pool

Returns a snapshot row per cache store (plan cache, token cache, metadata cache, etc.). Useful for identifying cache pressure when pages_kb is high but entries_count is low (large cached objects) or when entries_in_use_count is much smaller than entries_count (cache bloat).


SQL Server | sys.dm_os_ring_buffers | internal ring buffer records

Scope: server-wide · Permissions: VIEW SERVER STATE Used in: system-functions-and-session-metadata

Returns internal ring buffer records used for lightweight diagnostics. Records are XML-based and cover connectivity, memory state, scheduler state, and security events. Useful for post-mortem analysis when other DMVs have been reset.


SQL Server | sys.dm_os_workers | worker thread state

Scope: server-wide · Permissions: VIEW SERVER STATE Used in: system-functions-and-session-metadata

Returns one row per active worker thread. Workers map 1:1 to tasks — each task gets one worker from the thread pool. Monitor state and is_preemptive to diagnose thread pool exhaustion or extended preemptive waits (external calls like linked servers, CLR, xp_cmdshell).


Database — Indexes

SQL Server | sys.dm_db_index_physical_stats | index size and fragmentation

Scope: database or server-wide · Permissions: VIEW DATABASE STATE · Type: table-valued function Used in: essential-dba-queries · sql-server-problems · performance-audit-playbook · database-creation-and-file-layout · storage-internals · schemas-tables-and-constraints · keys-defaults-identity-and-sequences · index-types-and-strategy · index-maintenance

Table-valued function: sys.dm_db_index_physical_stats(db_id, object_id, index_id, partition_number, mode). Returns size, fragmentation, and page density for indexes. The mode parameter controls scan depth: LIMITED (fast, heap/B-tree page count only), SAMPLED (1% leaf-level sample), DETAILED (full scan — expensive on large indexes).


SQL Server | sys.dm_db_index_operational_stats | per-index I/O, locking, and latching

Scope: database or server-wide · Permissions: VIEW DATABASE STATE · Type: table-valued function · Resets: instance restart Used in: troubleshooting-flowcharts · storage-internals · index-types-and-strategy · index-maintenance · table-compression · blocking-and-locking

Table-valued function: sys.dm_db_index_operational_stats(db_id, object_id, index_id, partition_number). Returns cumulative low-level I/O, row-lock, page-lock, latch, and insert/update/delete activity per index partition. Key DMV for identifying hot indexes causing lock contention or latch waits.


SQL Server | sys.dm_db_index_usage_stats | index operation counts by type

Scope: server-wide · Permissions: VIEW SERVER STATE · Resets: instance restart, database detach, or database offline Used in: troubleshooting-flowcharts · finops-cost-optimization · index-types-and-strategy · index-maintenance · json-xml-and-semi-structured-data · merge-and-upsert · sargable-queries · system-functions-and-session-metadata

Returns cumulative seek, scan, lookup, and update counters per index. An index with high user_updates but zero user_seeks and user_scans is a candidate for removal — it consumes write overhead without serving reads.


SQL Server | sys.dm_db_missing_index_details | missing index column recommendations

Scope: server-wide · Permissions: VIEW SERVER STATE · Resets: instance restart Used in: essential-dba-queries · troubleshooting-flowcharts · index-types-and-strategy · index-maintenance · execution-plans

Returns one row per missing index identified by the query optimizer during compilation. Join to sys.dm_db_missing_index_groups (on index_handle) and then to sys.dm_db_missing_index_group_stats (on group_handle) for impact metrics.


SQL Server | sys.dm_db_missing_index_group_stats | missing index group impact

Scope: server-wide · Permissions: VIEW SERVER STATE · Resets: instance restart Used in: essential-dba-queries · troubleshooting-flowcharts · index-types-and-strategy · index-maintenance

Returns aggregate impact statistics for each missing index group. The avg_total_user_cost * avg_user_impact * (user_seeks + user_scans) formula ranks missing indexes by potential benefit.


SQL Server | sys.dm_db_missing_index_groups | missing index group membership

Scope: server-wide · Permissions: VIEW SERVER STATE · Resets: instance restart Used in: essential-dba-queries · troubleshooting-flowcharts · index-types-and-strategy · index-maintenance

Bridge table linking dm_db_missing_index_group_stats.group_handle to dm_db_missing_index_details.index_handle. Each group typically contains one missing index, but the optimizer may group related missing indexes together.


Database — Files and Space

SQL Server | sys.dm_io_virtual_file_stats | data and log file I/O statistics

Scope: database or server-wide · Permissions: VIEW SERVER STATE · Type: table-valued function · Resets: instance restart Used in: essential-dba-queries · sql-server-problems · performance-audit-playbook · wait-stats-analysis · system-functions-and-session-metadata

Table-valued function: sys.dm_io_virtual_file_stats(database_id, file_id). Returns cumulative I/O statistics per database file. The go-to DMV for diagnosing storage latency — compute average read/write latency as io_stall_read_ms / num_of_reads and io_stall_write_ms / num_of_writes.


SQL Server | sys.dm_db_log_space_usage | transaction log space consumption

Scope: current database · Permissions: VIEW DATABASE STATE Used in: essential-dba-queries · sql-server-problems · finops-cost-optimization · database-creation-and-file-layout · storage-internals · schemas-tables-and-constraints

Returns a single row with log space usage for the current database context. Quick check for log fullness without the overhead of DBCC SQLPERF(LOGSPACE).


SQL Server | sys.dm_db_log_info | virtual log file (VLF) details

Scope: current database · Permissions: VIEW DATABASE STATE Used in: restore-and-recovery · performance-audit-playbook · finops-cost-optimization · database-creation-and-file-layout · storage-internals

Returns one row per VLF in the transaction log. Replaces the undocumented DBCC LOGINFO. High VLF counts (> 1000) degrade log management operations like backup, restore, and recovery.


SQL Server | sys.dm_db_file_space_usage | data file space breakdown

Scope: current database · Permissions: VIEW DATABASE STATE Used in: troubleshooting-flowcharts · performance-audit-playbook · storage-internals

Returns one row per data file showing the breakdown of allocated vs. unallocated space. Particularly useful for tempdb to identify version store, internal object, and user object consumption.


SQL Server | sys.dm_db_log_stats | transaction log summary statistics

Scope: database · Permissions: VIEW DATABASE STATE · Type: table-valued function Used in: storage-internals

Table-valued function: sys.dm_db_log_stats(database_id). Returns a single row with summary transaction log statistics including recovery model, backup timestamps, and log reuse wait reason. Provides a superset of information compared to sys.databases log columns.


SQL Server | sys.dm_db_database_page_allocations | per-page allocation map

Scope: database · Permissions: VIEW DATABASE STATE · Type: table-valued function Used in: storage-internals

Undocumented table-valued function: sys.dm_db_database_page_allocations(db_id, object_id, index_id, partition_id, mode). Returns one row per allocated page. Use mode = 'DETAILED' for full metadata or 'LIMITED' for faster results. Extremely expensive on large databases — use only for targeted investigations.


SQL Server | sys.dm_db_page_info | single-page metadata lookup

Scope: database · Permissions: VIEW DATABASE STATE · Type: table-valued function Used in: storage-internals

Table-valued function: sys.dm_db_page_info(database_id, file_id, page_id, mode). Returns metadata for a single page without the overhead of DBCC PAGE. SQL Server 2019+ only. Useful for decoding page_resource from dm_exec_requests during latch contention analysis.


Database — Statistics and Storage

SQL Server | sys.dm_db_partition_stats | partition-level page and row counts

Scope: current database · Permissions: VIEW DATABASE STATE Used in: essential-dba-queries · table-compression · partitioning-strategies

Returns row and page counts per partition per index. More accurate than sys.partitions.rows because it includes in-row, LOB, and row-overflow pages. The lightweight alternative to querying dm_db_index_physical_stats when you only need sizes.


SQL Server | sys.dm_db_stats_properties | statistics object properties and staleness

Scope: database · Permissions: VIEW DATABASE STATE · Type: table-valued function Used in: sql-server-problems · performance-audit-playbook · index-maintenance

Table-valued function: sys.dm_db_stats_properties(object_id, stats_id). Returns when a statistics object was last updated, how many rows were sampled, and modification counters. Essential for detecting stale statistics that cause poor query plan choices.


SQL Server | sys.dm_db_column_store_row_group_physical_stats | columnstore rowgroup health

Scope: current database · Permissions: VIEW DATABASE STATE Used in: performance-audit-playbook · schemas-tables-and-constraints · index-types-and-strategy · index-maintenance

Returns one row per rowgroup in a columnstore index with physical state, row counts, and size. Key diagnostic for determining when to run ALTER INDEX REORGANIZE (to compress open delta stores or remove deleted rows) or ALTER INDEX REBUILD.


SQL Server | sys.dm_db_persisted_sku_features | edition-locked features in use

Scope: current database · Permissions: VIEW DATABASE STATE Used in: finops-cost-optimization

Returns one row per Enterprise-only feature actively used in the current database. Used during FinOps review to determine if a database can be migrated to Standard Edition or if Enterprise features are blocking a license downgrade.


SQL Server | sys.dm_db_xtp_hash_index_stats | In-Memory OLTP hash index stats

Scope: current database · Permissions: VIEW DATABASE STATE Used in: schemas-tables-and-constraints

Returns hash index statistics for memory-optimized tables. Key diagnostic for detecting undersized bucket counts (high avg_chain_length) or oversized allocations (very low empty_bucket_percent is bad, but > 90% empty is wasted memory).


Transactions and Locking

SQL Server | sys.dm_os_waiting_tasks | tasks currently waiting on a resource

Scope: server-wide · Permissions: VIEW SERVER STATE Used in: essential-dba-queries · sql-server-problems · troubleshooting-flowcharts · blocking-and-locking

Returns one row per task that is currently waiting. Unlike dm_os_wait_stats (aggregate since startup), this shows the real-time wait picture. Joins to dm_exec_sessions on session_id and to dm_exec_requests for full context.


SQL Server | sys.dm_tran_active_transactions | currently active transactions

Scope: server-wide · Permissions: VIEW SERVER STATE Used in: essential-dba-queries · backup-types-and-strategy · sql-server-problems · performance-audit-playbook · system-functions-and-session-metadata

Returns one row per active transaction. Join to dm_tran_session_transactions on transaction_id to find the owning session, then to dm_tran_database_transactions for database-level impact. Long-running transactions block log truncation and version store cleanup.


SQL Server | sys.dm_tran_locks | currently held lock resources

Scope: server-wide · Permissions: VIEW SERVER STATE Used in: troubleshooting-flowcharts · blocking-and-locking · race-conditions

Returns one row per currently active lock manager request. The definitive view for understanding blocking chains — filter on request_status = 'WAIT' to find blocked requests, then trace resource_associated_entity_id to identify the contested object.


SQL Server | sys.dm_tran_session_transactions | session-to-transaction correlation

Scope: server-wide · Permissions: VIEW SERVER STATE Used in: essential-dba-queries · sql-server-problems · system-functions-and-session-metadata

Bridge table linking sessions to their transactions. One session can have multiple transactions (nested, savepoints); one transaction maps to exactly one session (excluding distributed transactions).


SQL Server | sys.dm_tran_database_transactions | database-level transaction state

Scope: server-wide · Permissions: VIEW SERVER STATE Used in: essential-dba-queries · performance-audit-playbook

Returns one row per transaction per database showing log usage, tempdb usage, and the longest-running transaction in each database. Critical for understanding log space consumption and identifying transactions blocking log truncation.


SQL Server | sys.dm_tran_version_store | tempdb version store records

Scope: server-wide · Permissions: VIEW SERVER STATE Used in: memory-and-buffer-pool

Returns one row per version record in the tempdb version store. The version store supports snapshot isolation, read committed snapshot, online index operations, triggers (for INSERTED/DELETED), and MARS. Use dm_tran_version_store_space_usage for per-database space totals instead of scanning this entire set.


SQL Server | sys.dm_tran_version_store_space_usage | version store space per database

Scope: server-wide · Permissions: VIEW SERVER STATE Used in: sql-server-problems · performance-audit-playbook · database-creation-and-file-layout

Returns the total version store space consumed in tempdb per database. Lightweight alternative to scanning dm_tran_version_store. Use this to identify which database is driving tempdb version store growth during snapshot isolation workloads.


High Availability (HADR)

SQL Server | sys.dm_hadr_database_replica_states | AG database replica health

Scope: server-wide · Permissions: VIEW SERVER STATE Used in: high-availability-overview · always-on-availability-groups · sql-server-problems · troubleshooting-flowcharts

Returns one row per database replica in each AG. The primary DMV for AG health monitoring — watch synchronization_state_desc, redo_queue_size, and log_send_queue_size for replication lag.


SQL Server | sys.dm_hadr_availability_replica_states | AG replica connection and sync state

Scope: server-wide · Permissions: VIEW SERVER STATE Used in: high-availability-overview · always-on-availability-groups

Returns one row per replica in each AG with connection state and role. Complements the database-level detail in dm_hadr_database_replica_states with replica-level aggregates.


SQL Server | sys.dm_hadr_cluster | WSFC cluster-level information

Scope: server-wide · Permissions: VIEW SERVER STATE Used in: high-availability-overview

Returns a single row with Windows Server Failover Clustering information for the node hosting this SQL Server instance.


SQL Server | sys.dm_hadr_cluster_members | cluster node membership

Scope: server-wide · Permissions: VIEW SERVER STATE Used in: high-availability-overview

Returns one row per WSFC cluster member (nodes and witnesses) with vote weight and state.


SQL Server | sys.dm_hadr_automatic_seeding | automatic seeding progress

Scope: server-wide · Permissions: VIEW SERVER STATE Used in: high-availability-overview · always-on-availability-groups

Returns one row per automatic seeding operation. Automatic seeding (SQL Server 2016+) eliminates the need for manual backup/restore when adding replicas.


Audit and Extended Events

SQL Server | sys.dm_xe_sessions | active Extended Event sessions

Scope: server-wide · Permissions: VIEW SERVER STATE Used in: sql-server-problems · troubleshooting-flowcharts · performance-audit-playbook · deadlock-detection-and-prevention

Returns one row per active XE session. The system_health session is always active by default and captures deadlocks, severe errors, and memory issues.


SQL Server | sys.dm_xe_session_targets | XE session target configuration

Scope: server-wide · Permissions: VIEW SERVER STATE Used in: sql-server-problems · troubleshooting-flowcharts · performance-audit-playbook · deadlock-detection-and-prevention

Returns one row per target attached to an active XE session. The target_data column contains the buffered XML payload — for the ring_buffer target this is the in-memory event data; for event_file it contains the file path.


SQL Server | sys.dm_audit_actions | audit action definitions

Scope: server-wide · Permissions: VIEW SERVER STATE Used in: audit-logging

Returns one row per audit action that can be used in server or database audit specifications. Reference table for building ADD (action_id) clauses in CREATE SERVER AUDIT SPECIFICATION and CREATE DATABASE AUDIT SPECIFICATION.


SQL Server | sys.dm_audit_class_type_map | audit class type mappings

Scope: server-wide · Permissions: VIEW SERVER STATE Used in: audit-logging

Returns the mapping between audit class_type codes (2-character codes in audit logs) and the corresponding securable_class_desc names. Used to decode the class_type field in audit log output.


SQL Server | sys.dm_server_audit_status | current server audit state

Scope: server-wide · Permissions: VIEW SERVER STATE Used in: audit-logging

Returns one row per server audit with its current operational status. Use to verify that audits are actively collecting events and to check for failures.


Server State and Encryption

SQL Server | sys.dm_database_encryption_keys | database encryption key state

Scope: server-wide · Permissions: VIEW SERVER STATE Used in: tde-encryption · sql-server-problems

Returns one row per database that has a database encryption key (DEK), regardless of whether TDE is active. The encryption_state column tracks the full TDE lifecycle from unencrypted through encryption scan to fully encrypted.


SQL Server | sys.dm_server_services | SQL Server service information

Scope: server-wide · Permissions: VIEW SERVER STATE Used in: database-creation-and-file-layout

Returns one row per SQL Server-related service (Database Engine, Agent, Full-Text, etc.) with service account, startup type, PID, and installation path.


SQL Server | sys.dm_server_suspend_status | server suspend state

Scope: server-wide · Permissions: VIEW SERVER STATE Used in: finops-cost-optimization

Returns information about whether the SQL Server instance is in a suspended state. Relevant for Azure SQL Managed Instance serverless tier and SQL Server 2022+ suspend/resume functionality.


SQL Server | sys.dm_cdc_errors | CDC log scan error information

Scope: server-wide · Permissions: VIEW SERVER STATE Used in: sql-server-change-tracking

Returns one row per error encountered by the CDC log scan process. CDC relies on a background agent job reading the transaction log — errors here can silently stall change data capture. Check this DMV when CDC consumers report missing changes.


System Functions (sys.fn_*)

SQL Server | sys.fn_get_audit_file | read audit file records

Scope: server-wide · Permissions: CONTROL SERVER · Type: table-valued function Used in: sql-server-authentication · audit-logging

Reads SQL Server audit log files (.sqlaudit) and returns the events as a result set. The primary way to query audit data programmatically. sys.fn_get_audit_file_v2 (SQL Server 2022+) adds sequence_group_id for reliable ordering.


SQL Server | sys.fn_xe_file_target_read_file | read XE event_file target

Scope: server-wide · Permissions: VIEW SERVER STATE · Type: table-valued function Used in: troubleshooting-flowcharts · performance-audit-playbook · deadlock-detection-and-prevention

Reads Extended Events .xel files and returns each event as an XML row. Standard way to consume persisted XE data for deadlock analysis, query timeouts, and error diagnostics.


SQL Server | sys.fn_hadr_backup_is_preferred_replica | AG backup preference check

Scope: database · Permissions: PUBLIC · Type: scalar function Used in: high-availability-overview · always-on-availability-groups

Returns 1 if the current replica is the preferred backup replica for the specified database, based on the AG’s AUTOMATED_BACKUP_PREFERENCE setting. Used in backup job logic to ensure only the designated replica runs backups.


SQL Server | sys.fn_cdc_get_max_lsn | current maximum CDC LSN

Scope: database · Permissions: PUBLIC · Type: scalar function Used in: sql-server-change-tracking

Returns the maximum LSN from the cdc.lsn_time_mapping table, representing the upper boundary of captured changes. Used as the @to_lsn parameter when calling cdc.fn_cdc_get_all_changes_* or cdc.fn_cdc_get_net_changes_*.


SQL Server | sys.fn_cdc_get_min_lsn | minimum valid CDC LSN for a capture instance

Scope: database · Permissions: PUBLIC · Type: scalar function Used in: sql-server-change-tracking

Returns the minimum valid LSN for a specific capture instance, representing the lower boundary of available change data. Changes before this LSN have been cleaned up by the CDC cleanup job.


SQL Server | sys.fn_dblog | transaction log reader (undocumented)

Scope: current database · Permissions: sysadmin · Type: table-valued function Used in: storage-internals

Undocumented function that reads the active portion of the transaction log and returns individual log records. Used for forensic analysis and understanding log record structure. Not supported in production and subject to change.


SQL Server | sys.fn_builtin_permissions | built-in permission definitions

Scope: server-wide · Permissions: PUBLIC · Type: table-valued function Used in: users-logins-roles-permissions

Returns the full permission hierarchy — one row per permission per securable class. Used to discover all available permissions for a given class (SERVER, DATABASE, OBJECT, SCHEMA, etc.) and to understand permission implication chains.


SQL Server | sys.fn_helpcollations | available collation list

Scope: server-wide · Permissions: PUBLIC · Type: table-valued function Used in: data-types-conversion-and-null-handling

Returns one row per collation supported by the SQL Server instance, with name and description. Used when selecting collations for database or column creation.


Appendix — Catalog Views Quick Index

Object Model

Catalog ViewPurposeSource Pages
sys.objectsAll schema-scoped objectsSO:14,17 · DDS:01,03,05,06,08 · QWO:15
sys.all_objectsAll objects including system objectsDDS:02,07 · QWO:19
sys.tablesUser tablesSO:06,14,17 · DDS:01,03,05,09,10 · QWO:09,16,19 · APP:01,02,03,04,06,08
sys.viewsUser viewsDDS:03
sys.schemasSchemasSO:17 · DDS:03,05 · QWO:09,16,19 · APP:01,02,03,04,06,08
sys.columnsTable and view columnsSO:14 · DDS:03,04,05,06,07,10 · QWO:02,07,09,15 · APP:05,06
sys.computed_columnsComputed columnsDDS:03
sys.identity_columnsIdentity columnsDDS:03,04
sys.typesSystem and user-defined data typesSO:14 · DDS:03,04 · QWO:02,07,15
sys.parametersStored procedure and function parametersQWO:15
sys.sql_modulesSQL module definitions (views, procs, triggers)SO:02,14

Indexes and Statistics

Catalog ViewPurposeSource Pages
sys.indexesAll indexes on tables and viewsSO:06,14,15,16,17 · DDS:01,03,06,07,08,09,10 · QWO:04,09,12,15,16,20 · APP:05,06,08
sys.index_columnsIndex key and included columnsDDS:03,06,07 · QWO:09,12 · APP:05,06
sys.index_resumable_operationsIn-progress resumable index operationsDDS:07
sys.statsStatistics objectsSO:14,16 · DDS:07,09
sys.partitionsTable and index partitionsSO:14,17 · DDS:01,03,05,06,08,09 · QWO:09,13,15,16 · APP:01,03

Constraints and Keys

Catalog ViewPurposeSource Pages
sys.key_constraintsPrimary key and unique constraintsDDS:03
sys.foreign_keysForeign key relationshipsDDS:03
sys.foreign_key_columnsForeign key column mappingsDDS:03
sys.check_constraintsCHECK constraintsDDS:03 · QWO:09
sys.default_constraintsDEFAULT constraintsDDS:03,04,05
sys.sequencesSequence objectsDDS:04

Database and Files

Catalog ViewPurposeSource Pages
sys.databasesAll databases on the instanceSO:02,03,05,06,07,08,09,10,13,14,16,17 · DDS:01,02,07,10 · QWO:05,13,14,16,18 · APP:01,02
sys.database_filesFiles in the current databaseSO:01,14,15,16,17 · DDS:01,02 · QWO:14
sys.master_filesAll files across all databasesSO:06,07,14,16,17 · DDS:01 · QWO:14
sys.filegroupsFilegroups in the current databaseDDS:01
sys.allocation_unitsAllocation unitsSO:14,17 · DDS:01
sys.data_spacesData spaces (filegroups and partition schemes)DDS:09
sys.database_scoped_configurationsDatabase-scoped configuration optionsSO:11
sys.database_query_store_optionsQuery Store configurationSO:14 · DDS:01 · QWO:20
sys.database_automatic_tuning_optionsAutomatic tuning settingsSO:14
sys.database_ledger_transactionsLedger transaction historyDDS:03

Server Configuration

Catalog ViewPurposeSource Pages
sys.configurationsInstance-level sp_configure settingsSO:01,02,05,11,14,16,17 · DDS:07
sys.serversLinked serversSO:05
sys.endpointsServer endpointsSO:09
sys.endpoint_permissionsEndpoint permissionsSO:09
sys.tcp_endpointsTCP endpoint detailsSO:09

Security and Authentication

Catalog ViewPurposeSource Pages
sys.server_principalsServer-level logins and rolesSO:03,04,16 · QWO:15
sys.server_permissionsServer-level permissionsSO:03
sys.server_role_membersServer role membershipSO:03,16
sys.sql_loginsSQL Authentication loginsSO:03,04
sys.database_principalsDatabase-level users and rolesSO:03,04,16 · DDS:03,05 · QWO:15
sys.database_permissionsDatabase-level permissionsSO:03,05,16 · DDS:05
sys.database_role_membersDatabase role membershipSO:04
sys.security_policiesRow-level security policiesSO:04
sys.credentialsServer credentialsSO:07,08
sys.certificatesCertificatesSO:07,09,10,13,14
sys.symmetric_keysSymmetric keysSO:07,13
sys.asymmetric_keysAsymmetric keysSO:14
sys.database_mirroring_endpointsMirroring endpointsSO:09

Audit

Catalog ViewPurposeSource Pages
sys.server_auditsServer audit definitionsSO:03,12
sys.server_audit_specificationsServer audit specificationsSO:03,12
sys.server_audit_specification_detailsServer audit spec detailsSO:12
sys.database_audit_specificationsDatabase audit specificationsSO:12
sys.database_audit_specification_detailsDatabase audit spec detailsSO:12
sys.server_file_auditsFile-based audit targetsSO:12

Availability Groups

Catalog ViewPurposeSource Pages
sys.availability_groupsAG definitionsSO:09,15
sys.availability_replicasAG replica configurationSO:09,10,15
sys.availability_read_only_routing_listsRead-only routing configurationSO:09,10

Partitioning

Catalog ViewPurposeSource Pages
sys.partition_functionsPartition function definitionsDDS:01,09
sys.partition_schemesPartition scheme definitionsDDS:01,09
sys.partition_range_valuesPartition boundary valuesDDS:01,09

Change Tracking and CDC

Catalog ViewPurposeSource Pages
sys.change_tracking_databasesDatabases with CT enabledDDS:10
sys.change_tracking_tablesTables with CT enabledDDS:10
sys.syscommittabCT commit tracking tableDDS:10

Query Store

Catalog ViewPurposeSource Pages
sys.query_store_queryQuery objects in Query StoreSO:14 · QWO:13,14,20 · APP:07
sys.query_store_query_textQuery text in Query StoreSO:14,16 · QWO:13,14,20 · APP:07
sys.query_store_planExecution plans in Query StoreSO:14 · QWO:13,14,20
sys.query_store_runtime_statsRuntime statistics per planSO:14,16 · QWO:13,14,20
sys.query_store_runtime_stats_intervalStatistics collection intervalsQWO:20
sys.query_store_wait_statsPer-query wait statisticsSO:06,16 · QWO:20
sys.query_store_query_hintsQuery Store hintsQWO:13,20
sys.query_store_plan_feedbackPlan feedback entriesQWO:13
sys.plan_persist_planPersisted plan dataSO:06

XML

Catalog ViewPurposeSource Pages
sys.xml_indexesXML indexesQWO:09
sys.xml_schema_collectionsRegistered XML schema collectionsQWO:09
sys.xml_schema_namespacesXML schema namespacesQWO:09

Miscellaneous

Catalog ViewPurposeSource Pages
sys.time_zone_infoTime zone definitions available to AT TIME ZONEQWO:08
sys.sysprocessesLegacy process view (use dm_exec_sessions/requests instead)SO:02
sys.syslanguagesLanguage definitionsQWO:15

Appendix — System Stored Procedures

CDC Procedures

ProcedurePurposeSource Pages
sys.sp_cdc_enable_dbEnable CDC on a databaseDDS:10
sys.sp_cdc_disable_dbDisable CDC on a databaseDDS:10
sys.sp_cdc_enable_tableEnable CDC on a tableDDS:10
sys.sp_cdc_disable_tableDisable CDC on a tableDDS:10
sys.sp_cdc_scanManually trigger a CDC log scan (when Agent is unavailable)DDS:10
sys.sp_cdc_change_jobModify CDC capture or cleanup job parametersDDS:10

Query Store Procedures

ProcedurePurposeSource Pages
sys.sp_query_store_force_planForce a specific execution plan for a querySO:14 · QWO:20
sys.sp_query_store_unforce_planRemove a forced planSO:14 · QWO:20
sys.sp_query_store_flush_dbFlush in-memory Query Store data to diskQWO:20
sys.sp_query_store_set_hintsApply Query Store hints to a queryQWO:20
sys.sp_query_store_clear_hintsRemove Query Store hintsQWO:20

General System Procedures

ProcedurePurposeSource Pages
sys.sp_executesqlExecute parameterized dynamic SQLQWO:19
sys.sp_getapplockAcquire an application-level lockQWO:18
sys.sp_set_session_contextSet session context key-value pairsQWO:15
sys.sp_helpdbDatabase summary informationSO:02
sys.sp_databasesList accessible databasesQWO:10
sys.sp_sequence_get_rangePreallocate a range of sequence valuesDDS:04
sys.sp_cleanup_temporal_historyClean up temporal table historyDDS:10

Extended Stored Procedures

ProcedurePurposeSource Pages
sys.xp_readerrorlogRead SQL Server error log entriesSO:02
sys.xp_fileexistCheck if a file exists on diskSO:13