SlideShare a Scribd company logo
Building diagnostic queries using DMVs and DMFs
Building Diagnostic Queries
Using DMVs and DMFs
Greek MVPs in Action
Virtual Event
Mar 29, 2020
Building diagnostic queries using DMVs and DMFs
Please mute
your mic
Antonios Chatzipavlis
Data Solutions Consultant & Trainer
Since 1999
30+Years in a Field
20+
Experience with
60+
Certifications
SQLschool.gr
Founder
A community for Greek professionals who use the
Microsoft Data Platform
Connect / Explore / Learn
@antoniosch - @sqlschool
./sqlschoolgr - ./groups/sqlschool
yt/c/SqlschoolGr
SQLschool.gr Group
help@sqlschool.gr
Join us
Articles
SQL Saturday Nights
SQL Server in Greek
Webcasts
News
Resources
Connect / Explore / Learn
10
Celebrating
2010-2020
years
Building diagnostic queries using DMVs and DMFs
Presentation Content
Building Diagnostic
Queries Using
DMVs and DMFs
• What is DMVs/DMFs
• Query Execution DMVs/DMFs
• Query Plan cache DMVs/DMFs
• Troubleshooting with DMVs/DMFs
• DMVs and DMFs return server-state
information
- They are virtual objects that return state
information
- The state is cleared when the server
instance is restarted or an administrator
clears the state information.
• Can be used
- monitor the health of a server instance
- diagnose problems
- tune performance
• Two types:
- Server-scoped—require VIEW SERVER
STATE permission
- Database-scoped—require VIEW
DATABASE STATE permission
• All DMVs and DMFs exist in the sys
schema and follow the naming
convention dm_%.
- They are defined in the resource database
and are mapped to other databases.
What is DMVs/DMFs
Introduced as a new concept in SQL Server 2005
• sys.dm_exec_sessions (DMV)
- Returns one row per authenticated session
on SQL Server, shows information about
all active user connections and internal
tasks
• sys.dm_exec_requests (DMV)
- Returns information about each request
that is executing in SQL Server
• sys.dm_exec_sql_text (DMF)
- Returns the text of the SQL batch that is
identified by the specified sql_handle
• sys.dm_exec_input_buffer (DMF)
- Returns information about statements
submitted to an instance of SQL Server.
• sys.dm_os_waiting_tasks (DMV)
- Returns information about the wait queue
of tasks that are waiting on some
resource.
Query Execution DMVs/DMFs
The most common Query Execution DMVs/DMFs in usage
• sys.dm_exec_query_stats (DMV)
- Returns aggregate performance statistics
for cached query plans in SQL Server.
• sys.dm_exec_query_plan (DMF)
- Returns the Showplan in XML format for
the batch specified by the plan handle.
The plan specified by the plan handle can
either be cached or currently executing.
• sys.dm_exec_cached_plans (DMV)
- Returns a row for each query plan that is
cached by SQL Server for faster query
execution.
• sys.dm_exec_procedure_stats (DMV)
- Returns aggregate performance statistics
for cached stored procedures.
• sys.dm_exec_function_stats (DMV)
- Returns aggregate performance statistics
for cached functions.
• sys.dm_exec_trigger_stats
- Returns aggregate performance statistics
for cached triggers.
Query Plan cache DMVs/DMFs
Provide information about queries that are currently in the plan cache
Demonstration
Troubleshooting with DMVs/DMFs
Any
questions
Thank you!
@antoniosch - @sqlschool
./sqlschoolgr - ./groups/sqlschool
./c/SqlschoolGr
SQLschool.gr Group
Antonios Chatzipavlis
Data Solutions Consultant & Trainer
A community for Greek professionals who use the Microsoft Data Platform
Copyright © SQLschool.gr. All right reserved. PRESENTER MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION

More Related Content

What's hot (20)

PPTX
Sql Server 2014 In Memory
Ravi Okade
 
PPTX
Alwayson AG enhancements
Harsh Chawla
 
PDF
Pre and post tips to installing sql server correctly
Antonios Chatzipavlis
 
PDF
SQL Server AlwaysOn for Dummies SQLSaturday #202 Edition
Mark Broadbent
 
PDF
Implementing sql server always on
Sarabpreet Anand
 
PDF
Tips to install and manage always on availability groups in sql server 2012 &...
Antonios Chatzipavlis
 
PDF
Troubleshooting sql server
Antonios Chatzipavlis
 
PDF
Configuring sql server - SQL Saturday, Athens Oct 2014
Antonios Chatzipavlis
 
PPTX
Sql server’s high availability technologies
venkatchs
 
PPTX
SQLSaturday Bulgaria : HA & DR with SQL Server AlwaysOn Availability Groups
turgaysahtiyan
 
PDF
SQL Server 2012 High Availability with AlwaysOn Availability Groups
Edwin M Sarmiento
 
PPTX
AUDWC 2016 - Using SQL Server 20146 AlwaysOn Availability Groups for SharePoi...
Michael Noel
 
PPTX
Sql server 2012 AlwaysOn
Warwick Rudd
 
PPTX
AlwaysON Basics
Harsh Chawla
 
PPTX
Sql server 2012 - always on deep dive - bob duffy
Anuradha
 
PPTX
Always on in SQL Server 2012
Fadi Abdulwahab
 
PDF
Always on in sql server 2017
Gianluca Hotz
 
PPTX
Reduce latency and boost sql server io performance
Kevin Kline
 
PDF
Fundamentals of SQL Server 2012 Availability groups
Edwin M Sarmiento
 
PPTX
Geek Sync | SQL Security Principals and Permissions 101
IDERA Software
 
Sql Server 2014 In Memory
Ravi Okade
 
Alwayson AG enhancements
Harsh Chawla
 
Pre and post tips to installing sql server correctly
Antonios Chatzipavlis
 
SQL Server AlwaysOn for Dummies SQLSaturday #202 Edition
Mark Broadbent
 
Implementing sql server always on
Sarabpreet Anand
 
Tips to install and manage always on availability groups in sql server 2012 &...
Antonios Chatzipavlis
 
Troubleshooting sql server
Antonios Chatzipavlis
 
Configuring sql server - SQL Saturday, Athens Oct 2014
Antonios Chatzipavlis
 
Sql server’s high availability technologies
venkatchs
 
SQLSaturday Bulgaria : HA & DR with SQL Server AlwaysOn Availability Groups
turgaysahtiyan
 
SQL Server 2012 High Availability with AlwaysOn Availability Groups
Edwin M Sarmiento
 
AUDWC 2016 - Using SQL Server 20146 AlwaysOn Availability Groups for SharePoi...
Michael Noel
 
Sql server 2012 AlwaysOn
Warwick Rudd
 
AlwaysON Basics
Harsh Chawla
 
Sql server 2012 - always on deep dive - bob duffy
Anuradha
 
Always on in SQL Server 2012
Fadi Abdulwahab
 
Always on in sql server 2017
Gianluca Hotz
 
Reduce latency and boost sql server io performance
Kevin Kline
 
Fundamentals of SQL Server 2012 Availability groups
Edwin M Sarmiento
 
Geek Sync | SQL Security Principals and Permissions 101
IDERA Software
 

Similar to Building diagnostic queries using DMVs and DMFs (20)

PPTX
SQL Server Query Optimization, Execution and Debugging Query Performance
Vinod Kumar
 
PPTX
SQL Server Admin Best Practices with DMV's
Sparkhound Inc.
 
PPTX
Sql server lesson13
Ala Qunaibi
 
PPTX
Understanding DB2 Optimizer
terraborealis
 
PDF
SQL Server ASYNC_NETWORK_IO Wait Type Explained
Confio Software
 
PDF
Increased IT infrastructure effectiveness by 80% with Microsoft system center...
Aspire Systems
 
PPTX
CloudStack Metering - Working with Usage Data #CCCNA14
ShapeBlue
 
PDF
Modernizing SQL Server the Right Way
Juan Fabian
 
PPTX
Enhancements that will make your sql database roar sp1 edition sql bits 2017
Bob Ward
 
PDF
WebSphere Technical University: Top WebSphere Problem Determination Features
Chris Bailey
 
PPTX
PowerShell-and-DSC-Enables-DSCDevOps-1.pptx
prabhatthunuguntla
 
PDF
Movile Internet Movel SA: A Change of Seasons: A big move to Apache Cassandra
DataStax Academy
 
PDF
Cassandra Summit 2015 - A Change of Seasons
Eiti Kimura
 
PPT
Microsoft SQL Server - SQL Server Migrations Presentation
Microsoft Private Cloud
 
PPTX
Cloudsim & Green Cloud
Neda Maleki
 
PPTX
Geek Sync | Performance Tune Like an MVP
IDERA Software
 
PPTX
Sql Server
SandyShin
 
PDF
Access Data from XPages with the Relational Controls
Teamstudio
 
PPTX
Copy Data Management for the DBA
Kellyn Pot'Vin-Gorman
 
PPT
Adaptive Server Farms for the Data Center
elliando dias
 
SQL Server Query Optimization, Execution and Debugging Query Performance
Vinod Kumar
 
SQL Server Admin Best Practices with DMV's
Sparkhound Inc.
 
Sql server lesson13
Ala Qunaibi
 
Understanding DB2 Optimizer
terraborealis
 
SQL Server ASYNC_NETWORK_IO Wait Type Explained
Confio Software
 
Increased IT infrastructure effectiveness by 80% with Microsoft system center...
Aspire Systems
 
CloudStack Metering - Working with Usage Data #CCCNA14
ShapeBlue
 
Modernizing SQL Server the Right Way
Juan Fabian
 
Enhancements that will make your sql database roar sp1 edition sql bits 2017
Bob Ward
 
WebSphere Technical University: Top WebSphere Problem Determination Features
Chris Bailey
 
PowerShell-and-DSC-Enables-DSCDevOps-1.pptx
prabhatthunuguntla
 
Movile Internet Movel SA: A Change of Seasons: A big move to Apache Cassandra
DataStax Academy
 
Cassandra Summit 2015 - A Change of Seasons
Eiti Kimura
 
Microsoft SQL Server - SQL Server Migrations Presentation
Microsoft Private Cloud
 
Cloudsim & Green Cloud
Neda Maleki
 
Geek Sync | Performance Tune Like an MVP
IDERA Software
 
Sql Server
SandyShin
 
Access Data from XPages with the Relational Controls
Teamstudio
 
Copy Data Management for the DBA
Kellyn Pot'Vin-Gorman
 
Adaptive Server Farms for the Data Center
elliando dias
 
Ad

More from Antonios Chatzipavlis (20)

PPTX
Data virtualization using polybase
Antonios Chatzipavlis
 
PDF
SQL server Backup Restore Revealed
Antonios Chatzipavlis
 
PDF
Migrate SQL Workloads to Azure
Antonios Chatzipavlis
 
PDF
Machine Learning in SQL Server 2019
Antonios Chatzipavlis
 
PDF
Workload Management in SQL Server 2019
Antonios Chatzipavlis
 
PDF
Loading Data into Azure SQL DW (Synapse Analytics)
Antonios Chatzipavlis
 
PDF
Introduction to DAX Language
Antonios Chatzipavlis
 
PDF
Designing a modern data warehouse in azure
Antonios Chatzipavlis
 
PDF
Designing a modern data warehouse in azure
Antonios Chatzipavlis
 
PDF
SQLServer Database Structures
Antonios Chatzipavlis
 
PDF
Sqlschool 2017 recap - 2018 plans
Antonios Chatzipavlis
 
PDF
Azure SQL Database for the SQL Server DBA - Azure Bootcamp Athens 2018
Antonios Chatzipavlis
 
PDF
Microsoft SQL Family and GDPR
Antonios Chatzipavlis
 
PDF
Statistics and Indexes Internals
Antonios Chatzipavlis
 
PDF
Introduction to Azure Data Lake
Antonios Chatzipavlis
 
PDF
Azure SQL Data Warehouse
Antonios Chatzipavlis
 
PDF
Introduction to azure document db
Antonios Chatzipavlis
 
PDF
Introduction to Machine Learning on Azure
Antonios Chatzipavlis
 
PDF
Introduction to sql database on azure
Antonios Chatzipavlis
 
PDF
Implementing Mobile Reports in SQL Sserver 2016 Reporting Services
Antonios Chatzipavlis
 
Data virtualization using polybase
Antonios Chatzipavlis
 
SQL server Backup Restore Revealed
Antonios Chatzipavlis
 
Migrate SQL Workloads to Azure
Antonios Chatzipavlis
 
Machine Learning in SQL Server 2019
Antonios Chatzipavlis
 
Workload Management in SQL Server 2019
Antonios Chatzipavlis
 
Loading Data into Azure SQL DW (Synapse Analytics)
Antonios Chatzipavlis
 
Introduction to DAX Language
Antonios Chatzipavlis
 
Designing a modern data warehouse in azure
Antonios Chatzipavlis
 
Designing a modern data warehouse in azure
Antonios Chatzipavlis
 
SQLServer Database Structures
Antonios Chatzipavlis
 
Sqlschool 2017 recap - 2018 plans
Antonios Chatzipavlis
 
Azure SQL Database for the SQL Server DBA - Azure Bootcamp Athens 2018
Antonios Chatzipavlis
 
Microsoft SQL Family and GDPR
Antonios Chatzipavlis
 
Statistics and Indexes Internals
Antonios Chatzipavlis
 
Introduction to Azure Data Lake
Antonios Chatzipavlis
 
Azure SQL Data Warehouse
Antonios Chatzipavlis
 
Introduction to azure document db
Antonios Chatzipavlis
 
Introduction to Machine Learning on Azure
Antonios Chatzipavlis
 
Introduction to sql database on azure
Antonios Chatzipavlis
 
Implementing Mobile Reports in SQL Sserver 2016 Reporting Services
Antonios Chatzipavlis
 
Ad

Recently uploaded (20)

PPTX
SlideEgg_501298-Agentic AI.pptx agentic ai
530BYManoj
 
PPTX
b6057ea5-8e8c-4415-90c0-ed8e9666ffcd.pptx
Anees487379
 
PPTX
BinarySearchTree in datastructures in detail
kichokuttu
 
PDF
Optimizing Large Language Models with vLLM and Related Tools.pdf
Tamanna36
 
PDF
apidays Singapore 2025 - Trustworthy Generative AI: The Role of Observability...
apidays
 
PPT
tuberculosiship-2106031cyyfuftufufufivifviviv
AkshaiRam
 
PPTX
Powerful Uses of Data Analytics You Should Know
subhashenia
 
PDF
apidays Singapore 2025 - The API Playbook for AI by Shin Wee Chuang (PAND AI)
apidays
 
PDF
Development and validation of the Japanese version of the Organizational Matt...
Yoga Tokuyoshi
 
PPTX
apidays Helsinki & North 2025 - Agentic AI: A Friend or Foe?, Merja Kajava (A...
apidays
 
PDF
The Best NVIDIA GPUs for LLM Inference in 2025.pdf
Tamanna36
 
PPTX
big data eco system fundamentals of data science
arivukarasi
 
PDF
Driving Employee Engagement in a Hybrid World.pdf
Mia scott
 
PDF
apidays Singapore 2025 - From API Intelligence to API Governance by Harsha Ch...
apidays
 
PPTX
03_Ariane BERCKMOES_Ethias.pptx_AIBarometer_release_event
FinTech Belgium
 
PDF
JavaScript - Good or Bad? Tips for Google Tag Manager
📊 Markus Baersch
 
PDF
apidays Singapore 2025 - Building a Federated Future, Alex Szomora (GSMA)
apidays
 
PDF
Technical-Report-GPS_GIS_RS-for-MSF-finalv2.pdf
KPycho
 
PPT
Growth of Public Expendituuure_55423.ppt
NavyaDeora
 
PPTX
apidays Helsinki & North 2025 - API access control strategies beyond JWT bear...
apidays
 
SlideEgg_501298-Agentic AI.pptx agentic ai
530BYManoj
 
b6057ea5-8e8c-4415-90c0-ed8e9666ffcd.pptx
Anees487379
 
BinarySearchTree in datastructures in detail
kichokuttu
 
Optimizing Large Language Models with vLLM and Related Tools.pdf
Tamanna36
 
apidays Singapore 2025 - Trustworthy Generative AI: The Role of Observability...
apidays
 
tuberculosiship-2106031cyyfuftufufufivifviviv
AkshaiRam
 
Powerful Uses of Data Analytics You Should Know
subhashenia
 
apidays Singapore 2025 - The API Playbook for AI by Shin Wee Chuang (PAND AI)
apidays
 
Development and validation of the Japanese version of the Organizational Matt...
Yoga Tokuyoshi
 
apidays Helsinki & North 2025 - Agentic AI: A Friend or Foe?, Merja Kajava (A...
apidays
 
The Best NVIDIA GPUs for LLM Inference in 2025.pdf
Tamanna36
 
big data eco system fundamentals of data science
arivukarasi
 
Driving Employee Engagement in a Hybrid World.pdf
Mia scott
 
apidays Singapore 2025 - From API Intelligence to API Governance by Harsha Ch...
apidays
 
03_Ariane BERCKMOES_Ethias.pptx_AIBarometer_release_event
FinTech Belgium
 
JavaScript - Good or Bad? Tips for Google Tag Manager
📊 Markus Baersch
 
apidays Singapore 2025 - Building a Federated Future, Alex Szomora (GSMA)
apidays
 
Technical-Report-GPS_GIS_RS-for-MSF-finalv2.pdf
KPycho
 
Growth of Public Expendituuure_55423.ppt
NavyaDeora
 
apidays Helsinki & North 2025 - API access control strategies beyond JWT bear...
apidays
 

Building diagnostic queries using DMVs and DMFs

  • 2. Building Diagnostic Queries Using DMVs and DMFs Greek MVPs in Action Virtual Event Mar 29, 2020
  • 5. Antonios Chatzipavlis Data Solutions Consultant & Trainer Since 1999 30+Years in a Field 20+ Experience with 60+ Certifications SQLschool.gr Founder
  • 6. A community for Greek professionals who use the Microsoft Data Platform Connect / Explore / Learn @antoniosch - @sqlschool ./sqlschoolgr - ./groups/sqlschool yt/c/SqlschoolGr SQLschool.gr Group [email protected] Join us Articles SQL Saturday Nights SQL Server in Greek Webcasts News Resources
  • 7. Connect / Explore / Learn 10 Celebrating 2010-2020 years
  • 9. Presentation Content Building Diagnostic Queries Using DMVs and DMFs • What is DMVs/DMFs • Query Execution DMVs/DMFs • Query Plan cache DMVs/DMFs • Troubleshooting with DMVs/DMFs
  • 10. • DMVs and DMFs return server-state information - They are virtual objects that return state information - The state is cleared when the server instance is restarted or an administrator clears the state information. • Can be used - monitor the health of a server instance - diagnose problems - tune performance • Two types: - Server-scoped—require VIEW SERVER STATE permission - Database-scoped—require VIEW DATABASE STATE permission • All DMVs and DMFs exist in the sys schema and follow the naming convention dm_%. - They are defined in the resource database and are mapped to other databases. What is DMVs/DMFs Introduced as a new concept in SQL Server 2005
  • 11. • sys.dm_exec_sessions (DMV) - Returns one row per authenticated session on SQL Server, shows information about all active user connections and internal tasks • sys.dm_exec_requests (DMV) - Returns information about each request that is executing in SQL Server • sys.dm_exec_sql_text (DMF) - Returns the text of the SQL batch that is identified by the specified sql_handle • sys.dm_exec_input_buffer (DMF) - Returns information about statements submitted to an instance of SQL Server. • sys.dm_os_waiting_tasks (DMV) - Returns information about the wait queue of tasks that are waiting on some resource. Query Execution DMVs/DMFs The most common Query Execution DMVs/DMFs in usage
  • 12. • sys.dm_exec_query_stats (DMV) - Returns aggregate performance statistics for cached query plans in SQL Server. • sys.dm_exec_query_plan (DMF) - Returns the Showplan in XML format for the batch specified by the plan handle. The plan specified by the plan handle can either be cached or currently executing. • sys.dm_exec_cached_plans (DMV) - Returns a row for each query plan that is cached by SQL Server for faster query execution. • sys.dm_exec_procedure_stats (DMV) - Returns aggregate performance statistics for cached stored procedures. • sys.dm_exec_function_stats (DMV) - Returns aggregate performance statistics for cached functions. • sys.dm_exec_trigger_stats - Returns aggregate performance statistics for cached triggers. Query Plan cache DMVs/DMFs Provide information about queries that are currently in the plan cache
  • 15. Thank you! @antoniosch - @sqlschool ./sqlschoolgr - ./groups/sqlschool ./c/SqlschoolGr SQLschool.gr Group Antonios Chatzipavlis Data Solutions Consultant & Trainer
  • 16. A community for Greek professionals who use the Microsoft Data Platform Copyright © SQLschool.gr. All right reserved. PRESENTER MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION