SlideShare a Scribd company logo
1 of 38
DMVs And Performance Monitor
in SQL Server
By
Zeba Tabassum
Agenda
Definition
DMVs Type
DMVs Category
Disadvantage Of DMVs
Performance Monitor
Counters
DMV’s
Definition
Dynamic management views and functions return server state information
that can be used to monitor the health of a server instance, diagnose
problems, and tune performance.
Prior to SQL Server 2005, we had several system tables(for example
sysprocesses, syslockinfo etc.) to monitor the state of the system. Though
these system tables are still available in SQL Server 2005 and in later versions
but SQL Server 2005 introduced whole new set of Dynamic Management
Views
DMV’s Type
There are two types of dynamic management views:-
• Server-scoped DMV’s They reside in master database and provide SQL
Server instance wide information. To access these DMV we need to have
SELECT permission on the objects and VIEW SERVER STATE permission on
the server.
• Database-scoped DMV’s They reside in each database and provide
database wide information. To access these DMV we need to have SELECT
permission on the objects and these require VIEW DATABASE STATE
permission on the database.
Listing DMVs
SELECT name AS DMV_Name,
[type] AS DMV_Type,
type_desc
FROM sys.system_objects
WHERE name LIKE 'dm_%'
ORDER BY name
SELECT count(*) TotalDMVCount
FROM sys.system_objects
WHERE name LIKE 'dm_%'
DMVs
The most frequently used DMV sections are:
• Database
• Execution
• IO
• Index
• SQL operating system
Database DMVs
Sys.dm_db_log_space_usage
sys.dm_db_partition_stats
sys.dm_db_file_space_usage
Sys.dm_db_task_space_usage
Database DMVs
SELECT TOP 3 object_name(object_id) AS objname,
in_row_data_page_count,
in_row_reserved_page_count,
used_page_count,
reserved_page_count,
row_count
FROM sys.dm_db_partition_stats
GO
Execution Related DMVs
• sys.dm_exec_connections
• sys.dm_exec_sessions
• sys.dm_exec_requests
• sys.dm_exec_cached_plans
• sys.dm_exec_query_plans
• sys.dm_exec_sql_text
• sys.dm_exec_query_stats
Execution Related DMVs
SELECT session_id,
login_name,
last_request_end_time,
cpu_time
FROM sys.dm_exec_sessions
WHERE session_id >= 61
GO
Execution Related DMVs
SELECT connection_id,
session_id,
client_net_address,
auth_scheme
FROM sys.dm_exec_connections
WHERE session_id >= 61
I/O Related DMV’s
• sys.dm_io_virtual_file_stats
• sys.dm_io_pending_io_requests
• sys.dm_io_cluster_shared_drives
I/O Related DMV’s
--Shows I/O stats for (data and log files) and virtual files no. of read and write
SELECT *
FROM sys.dm_io_pending_io_requests
GO
SELECT TOP 5 db_name(database_id) DataBaseName,
file_id,
num_of_reads,
num_of_writes
FROM sys.dm_io_virtual_file_stats(NULL, NULL)
Index Related DMVs
• sys.dm_db_index_physical_stats
• sys.dm_db_index_usage_stats
• sys.dm_db_index_operational_stats
• sys.dm_db_missing_index_details
• sys.dm_db_missing_index_groups
• sys.dm_db_missing_index_group_stats
• sys.dm_db_missing_index_columns
Index Related DMVs
--- Returns system_scansCounts with different date and objects
fragmentation of index operations. --
DECLARE @DBName VARCHAR(50)='testnew'
DECLARE @dbid BIGINT-- Database DB Id
SET @dbid=DB_ID(@DBName)
SELECT @DBName AS DataBaseName,
system_scans,
last_system_scan
FROM sys.dm_db_index_usage_stats
WHERE database_id = @dbid
Index Related DMVs
SELECT @DBName AS DataBaseName,
object_id,
avg_fragmentation_in_percent,
fragment_count
FROM sys.dm_db_index_physical_stats (@dbid, NULL, NULL, NULL, NULL)
WHERE database_id = @dbid
AND fragment_count > 0
Operating System Related DMVs
• sys.dm_os_performance_counters
• sys.dm_os_schedulers
• sys.dm_os_nodes
• sys.dm_os_waiting_tasks
• sys.dm_os_wait_stats
Operating System Related DMVs
---Returning cached page count for each database
SELECT COUNT(*)AS cached_pages_count,
db_name(database_id) AS database_name,
database_id
FROM sys.dm_os_buffer_descriptors
WHERE database_id NOT IN ( 32767, 4, 2, 1,3, 5 )
GROUP BY db_name(database_id),
database_id
ORDER BY cached_pages_count DESC;
GO
Operating System Related DMVs
--How memory is used overall on the server, and how much memory is
available
SELECT total_physical_memory_kb,
available_physical_memory_kb,
total_page_file_kb,
system_memory_state_desc
FROM
sys.dm_os_sys_memory
Disadvantages
• The biggest disadvantage in my opinion is the data in the DMVs is reset
upon SQL restart. So if you are trying to do trending type of reports, you'll
need to capture this DMV data on a regular basis to a DW somewhere.
DMV data is not guaranteed to be accurate at the time of retrieval. They
are updated asynchronously.
Performance Monitor
Performance Monitor, commonly referred to as PerfMon, is a Microsoft
Windows utility that allows us to capture :-
statistical information about the hardware environment, operating system,
and any applications that expose properties and counters.
We will learn how to use System Monitor to gather counters into counter
logs, which can be used to troubleshoot system and performance issues.
There are five major resource areas that can cause bottlenecks and affect
server performance:
physical disk,
memory,
process,
CPU, and
Network
If any of these resources are overutilized, your server or application can
become noticeably slow or can even crash.
Performance Counters
LogicalDisk% Free Space
This measures the percentage of free space on the selected logical disk drive.
Take note if this falls below 15 percent, you risk running out of free space for
the OS to store critical files. One obvious solution here is to add more disk
space.
PhysicalDisk% Idle Time
This measures the percentage of time the disk was idle during the sample interval. If
this counter falls below 20 percent, the disk system is saturated. You may consider
replacing the current disk system with a faster disk system.
Disk Counters
PhysicalDiskAvg. Disk Sec/Read :This measures the average time, in seconds,
to read data from the disk.
PhysicalDiskAvg. Disk Sec/Write:This measures the average time, in seconds,
it takes to write data to the disk.
PhysicalDiskAvg. Disk Queue Length :
This indicates how many I/O operations are waiting for the hard drive to
become available. If the value here is larger than the two times the number of
spindles, that means the disk itself may be the bottleneck.
Memory Counters
MemoryCache Bytes :This indicates the amount of memory being used for
the file system cache. There may be a disk bottleneck if this value is greater
than 300MB.
Memory% Committed Bytes in Use:This measures the ratio of Committed
Bytes to the Commit Limit—in other words, the amount of virtual memory in
use. This indicates insufficient memory if the number is greater than 80
percent. The obvious solution for this is to add more memory.
MemoryAvailable Mbytes:This measures the amount of physical memory, in
megabytes, available for running processes. If this value is less than 5 percent
of the total physical RAM, that means there is insufficient memory, and that
can increase paging activity. To resolve this problem, you should simply add
more memory.
MemoryPages per Second :This measures the rate at which pages are read
from or written to disk to resolve hard page faults. If the value is greater than
1,000, as a result of excessive paging, there may be a memory leak.
Processor Counters
Processor% Processor Time:This measures the percentage of elapsed time
the processor spends executing a non-idle thread. If the percentage is greater
than 85 percent, the processor is overwhelmed and the server may require a
faster processor.
Processor% User Time :This measures the percentage of elapsed time the
processor spends in user mode. If this value is high, the server is busy with
the application. One possible solution here is to optimize the application that
is using up the processor resources.
SystemProcessor Queue Length
This indicates the number of threads in the processor queue. The server
doesn't have enough processor power if the value is more than two times the
number of CPUs for an extended period of time.
Network Counters
Network InterfaceBytes Total/Sec :
This measures the rate at which bytes are sent and received over each
network adapter, including framing characters. The network is saturated if
you discover that more than 70 percent of the interface is consumed. For a
100-Mbps NIC, the interface consumed is 8.7MB/sec (100Mbps = 100000kbps
= 12.5MB/sec* 70 percent). In a situation like this, you may want to add a
faster network card or segment the network.
Network InterfaceOutput Queue Length:
This measures the length of the output packet queue, in packets. There is
network saturation if the value is more than 2. You can address this problem
by adding a faster network card or segmenting the network.
SQL Server Counters
SQLServer: General Statistics – User Connections
SQLServer: Memory Manager – Memory Grants Pending
SQLServer: SQL Statistics – Batch Requests/sec
SQLServer: SQL Statistics – Compilations/sec
SQLServer: SQL Statistics – Recompilations/sec
SQLServer:BufferManager - Buffer Cache hit ratio
This is the percentage of requests serviced by data cache. When cache is
properly used, this should be over 90%. The counter can be improved by
adding more RAM.
SQLServer:Databases,
SQL Server Counters
SQLServer:Exec Statistics,
SQLServer:General Statistics,
SQLServer:Latches,
SQLServer:Locks– Average Wait Time
This counter shows the average time needed to acquire a lock. This value needs to
be as low as possible.
SQLServer:MemoryManager– Target Server Memory (KB):
indicates how much memory SQL Server “wants”.
SQLServer:MemoryManager— Total Server Memory (KB):
Indicates how much memory SQL Server is actually using.
SQLServer:PlanCache
SQLServer:Access Methods – Full scans/sec:
higher numbers (> 1 or 2) may mean you are not using indexes and resorting to
table scans instead.

More Related Content

What's hot

SQL Server Upgrade and Consolidation - Methodology and Approach
SQL Server Upgrade and Consolidation - Methodology and ApproachSQL Server Upgrade and Consolidation - Methodology and Approach
SQL Server Upgrade and Consolidation - Methodology and ApproachIndra Dharmawan
 
Azure Data Factory Introduction.pdf
Azure Data Factory Introduction.pdfAzure Data Factory Introduction.pdf
Azure Data Factory Introduction.pdfMaheshPandit16
 
Introduction to snowflake
Introduction to snowflakeIntroduction to snowflake
Introduction to snowflakeSunil Gurav
 
PySpark dataframe
PySpark dataframePySpark dataframe
PySpark dataframeJaemun Jung
 
Databricks Platform.pptx
Databricks Platform.pptxDatabricks Platform.pptx
Databricks Platform.pptxAlex Ivy
 
Oracle E-Business Suite R12.2.6 on Database 12c: Install, Patch and Administer
Oracle E-Business Suite R12.2.6 on Database 12c: Install, Patch and AdministerOracle E-Business Suite R12.2.6 on Database 12c: Install, Patch and Administer
Oracle E-Business Suite R12.2.6 on Database 12c: Install, Patch and AdministerAndrejs Karpovs
 
[DSC Europe 22] Overview of the Databricks Platform - Petar Zecevic
[DSC Europe 22] Overview of the Databricks Platform - Petar Zecevic[DSC Europe 22] Overview of the Databricks Platform - Petar Zecevic
[DSC Europe 22] Overview of the Databricks Platform - Petar ZecevicDataScienceConferenc1
 
Introduction to Azure Data Factory
Introduction to Azure Data FactoryIntroduction to Azure Data Factory
Introduction to Azure Data FactorySlava Kokaev
 
Introducing the Snowflake Computing Cloud Data Warehouse
Introducing the Snowflake Computing Cloud Data WarehouseIntroducing the Snowflake Computing Cloud Data Warehouse
Introducing the Snowflake Computing Cloud Data WarehouseSnowflake Computing
 
ETL Testing Interview Questions and Answers
ETL Testing Interview Questions and AnswersETL Testing Interview Questions and Answers
ETL Testing Interview Questions and AnswersH2Kinfosys
 
Azure DataBricks for Data Engineering by Eugene Polonichko
Azure DataBricks for Data Engineering by Eugene PolonichkoAzure DataBricks for Data Engineering by Eugene Polonichko
Azure DataBricks for Data Engineering by Eugene PolonichkoDimko Zhluktenko
 
Azure Data Factory
Azure Data FactoryAzure Data Factory
Azure Data FactoryHARIHARAN R
 
Modern ETL Pipelines with Change Data Capture
Modern ETL Pipelines with Change Data CaptureModern ETL Pipelines with Change Data Capture
Modern ETL Pipelines with Change Data CaptureDatabricks
 
Presto: Optimizing Performance of SQL-on-Anything Engine
Presto: Optimizing Performance of SQL-on-Anything EnginePresto: Optimizing Performance of SQL-on-Anything Engine
Presto: Optimizing Performance of SQL-on-Anything EngineDataWorks Summit
 
Day1 Sap Basis Overview V1 1
Day1 Sap Basis Overview V1 1Day1 Sap Basis Overview V1 1
Day1 Sap Basis Overview V1 1Guang Ying Yuan
 
Azure Data Factory v2
Azure Data Factory v2Azure Data Factory v2
Azure Data Factory v2inovex GmbH
 
Introduction To Hadoop | What Is Hadoop And Big Data | Hadoop Tutorial For Be...
Introduction To Hadoop | What Is Hadoop And Big Data | Hadoop Tutorial For Be...Introduction To Hadoop | What Is Hadoop And Big Data | Hadoop Tutorial For Be...
Introduction To Hadoop | What Is Hadoop And Big Data | Hadoop Tutorial For Be...Simplilearn
 
Webinar: SAP HANA - Features, Architecture and Advantages
Webinar: SAP HANA - Features, Architecture and AdvantagesWebinar: SAP HANA - Features, Architecture and Advantages
Webinar: SAP HANA - Features, Architecture and AdvantagesAPPSeCONNECT
 

What's hot (20)

SQL Server Upgrade and Consolidation - Methodology and Approach
SQL Server Upgrade and Consolidation - Methodology and ApproachSQL Server Upgrade and Consolidation - Methodology and Approach
SQL Server Upgrade and Consolidation - Methodology and Approach
 
Azure Data Factory Introduction.pdf
Azure Data Factory Introduction.pdfAzure Data Factory Introduction.pdf
Azure Data Factory Introduction.pdf
 
Introduction to snowflake
Introduction to snowflakeIntroduction to snowflake
Introduction to snowflake
 
Architecting a datalake
Architecting a datalakeArchitecting a datalake
Architecting a datalake
 
PySpark dataframe
PySpark dataframePySpark dataframe
PySpark dataframe
 
Databricks Platform.pptx
Databricks Platform.pptxDatabricks Platform.pptx
Databricks Platform.pptx
 
Oracle E-Business Suite R12.2.6 on Database 12c: Install, Patch and Administer
Oracle E-Business Suite R12.2.6 on Database 12c: Install, Patch and AdministerOracle E-Business Suite R12.2.6 on Database 12c: Install, Patch and Administer
Oracle E-Business Suite R12.2.6 on Database 12c: Install, Patch and Administer
 
[DSC Europe 22] Overview of the Databricks Platform - Petar Zecevic
[DSC Europe 22] Overview of the Databricks Platform - Petar Zecevic[DSC Europe 22] Overview of the Databricks Platform - Petar Zecevic
[DSC Europe 22] Overview of the Databricks Platform - Petar Zecevic
 
Introduction to Azure Data Factory
Introduction to Azure Data FactoryIntroduction to Azure Data Factory
Introduction to Azure Data Factory
 
Introducing the Snowflake Computing Cloud Data Warehouse
Introducing the Snowflake Computing Cloud Data WarehouseIntroducing the Snowflake Computing Cloud Data Warehouse
Introducing the Snowflake Computing Cloud Data Warehouse
 
ETL Testing Interview Questions and Answers
ETL Testing Interview Questions and AnswersETL Testing Interview Questions and Answers
ETL Testing Interview Questions and Answers
 
Azure DataBricks for Data Engineering by Eugene Polonichko
Azure DataBricks for Data Engineering by Eugene PolonichkoAzure DataBricks for Data Engineering by Eugene Polonichko
Azure DataBricks for Data Engineering by Eugene Polonichko
 
Azure Data Factory
Azure Data FactoryAzure Data Factory
Azure Data Factory
 
Modern ETL Pipelines with Change Data Capture
Modern ETL Pipelines with Change Data CaptureModern ETL Pipelines with Change Data Capture
Modern ETL Pipelines with Change Data Capture
 
Presto: Optimizing Performance of SQL-on-Anything Engine
Presto: Optimizing Performance of SQL-on-Anything EnginePresto: Optimizing Performance of SQL-on-Anything Engine
Presto: Optimizing Performance of SQL-on-Anything Engine
 
ssis lab
ssis labssis lab
ssis lab
 
Day1 Sap Basis Overview V1 1
Day1 Sap Basis Overview V1 1Day1 Sap Basis Overview V1 1
Day1 Sap Basis Overview V1 1
 
Azure Data Factory v2
Azure Data Factory v2Azure Data Factory v2
Azure Data Factory v2
 
Introduction To Hadoop | What Is Hadoop And Big Data | Hadoop Tutorial For Be...
Introduction To Hadoop | What Is Hadoop And Big Data | Hadoop Tutorial For Be...Introduction To Hadoop | What Is Hadoop And Big Data | Hadoop Tutorial For Be...
Introduction To Hadoop | What Is Hadoop And Big Data | Hadoop Tutorial For Be...
 
Webinar: SAP HANA - Features, Architecture and Advantages
Webinar: SAP HANA - Features, Architecture and AdvantagesWebinar: SAP HANA - Features, Architecture and Advantages
Webinar: SAP HANA - Features, Architecture and Advantages
 

Similar to Dmv's & Performance Monitor in SQL Server

Sql server performance tuning
Sql server performance tuningSql server performance tuning
Sql server performance tuningJugal Shah
 
Sql server troubleshooting
Sql server troubleshootingSql server troubleshooting
Sql server troubleshootingNathan Winters
 
Troubleshooting SQL Server
Troubleshooting SQL ServerTroubleshooting SQL Server
Troubleshooting SQL ServerStephen Rose
 
Performance Tuning
Performance TuningPerformance Tuning
Performance TuningJannet Peetz
 
Sql server lesson13
Sql server lesson13Sql server lesson13
Sql server lesson13Ala Qunaibi
 
SQL Server ASYNC_NETWORK_IO Wait Type Explained
SQL Server ASYNC_NETWORK_IO Wait Type ExplainedSQL Server ASYNC_NETWORK_IO Wait Type Explained
SQL Server ASYNC_NETWORK_IO Wait Type ExplainedConfio Software
 
Performance Tuning And Optimization Microsoft SQL Database
Performance Tuning And Optimization Microsoft SQL DatabasePerformance Tuning And Optimization Microsoft SQL Database
Performance Tuning And Optimization Microsoft SQL DatabaseTung Nguyen Thanh
 
Sql Server Performance Tuning
Sql Server Performance TuningSql Server Performance Tuning
Sql Server Performance TuningBala Subra
 
http://www.hfadeel.com/Blog/?p=151
http://www.hfadeel.com/Blog/?p=151http://www.hfadeel.com/Blog/?p=151
http://www.hfadeel.com/Blog/?p=151xlight
 
Sql server performance tuning and optimization
Sql server performance tuning and optimizationSql server performance tuning and optimization
Sql server performance tuning and optimizationManish Rawat
 
IRJET - The 3-Level Database Architectural Design for OLAP and OLTP Ops
IRJET - The 3-Level Database Architectural Design for OLAP and OLTP OpsIRJET - The 3-Level Database Architectural Design for OLAP and OLTP Ops
IRJET - The 3-Level Database Architectural Design for OLAP and OLTP OpsIRJET Journal
 
SQL Explore 2012: P&T Part 1
SQL Explore 2012: P&T Part 1SQL Explore 2012: P&T Part 1
SQL Explore 2012: P&T Part 1sqlserver.co.il
 
How should I monitor my idaa
How should I monitor my idaaHow should I monitor my idaa
How should I monitor my idaaCuneyt Goksu
 
Quick guide to PostgreSQL Performance Tuning
Quick guide to PostgreSQL Performance TuningQuick guide to PostgreSQL Performance Tuning
Quick guide to PostgreSQL Performance TuningRon Morgan
 
Sap basis made_easy321761331053730
Sap basis made_easy321761331053730Sap basis made_easy321761331053730
Sap basis made_easy321761331053730K Hari Shankar
 
Movile Internet Movel SA: A Change of Seasons: A big move to Apache Cassandra
Movile Internet Movel SA: A Change of Seasons: A big move to Apache CassandraMovile Internet Movel SA: A Change of Seasons: A big move to Apache Cassandra
Movile Internet Movel SA: A Change of Seasons: A big move to Apache CassandraDataStax Academy
 
Cassandra Summit 2015 - A Change of Seasons
Cassandra Summit 2015 - A Change of SeasonsCassandra Summit 2015 - A Change of Seasons
Cassandra Summit 2015 - A Change of SeasonsEiti Kimura
 

Similar to Dmv's & Performance Monitor in SQL Server (20)

Sql server performance tuning
Sql server performance tuningSql server performance tuning
Sql server performance tuning
 
Performance tuning in sql server
Performance tuning in sql serverPerformance tuning in sql server
Performance tuning in sql server
 
Sql server troubleshooting
Sql server troubleshootingSql server troubleshooting
Sql server troubleshooting
 
Troubleshooting SQL Server
Troubleshooting SQL ServerTroubleshooting SQL Server
Troubleshooting SQL Server
 
Performance Tuning
Performance TuningPerformance Tuning
Performance Tuning
 
Sql Server
Sql ServerSql Server
Sql Server
 
Performance Tuning
Performance TuningPerformance Tuning
Performance Tuning
 
Sql server lesson13
Sql server lesson13Sql server lesson13
Sql server lesson13
 
SQL Server ASYNC_NETWORK_IO Wait Type Explained
SQL Server ASYNC_NETWORK_IO Wait Type ExplainedSQL Server ASYNC_NETWORK_IO Wait Type Explained
SQL Server ASYNC_NETWORK_IO Wait Type Explained
 
Performance Tuning And Optimization Microsoft SQL Database
Performance Tuning And Optimization Microsoft SQL DatabasePerformance Tuning And Optimization Microsoft SQL Database
Performance Tuning And Optimization Microsoft SQL Database
 
Sql Server Performance Tuning
Sql Server Performance TuningSql Server Performance Tuning
Sql Server Performance Tuning
 
http://www.hfadeel.com/Blog/?p=151
http://www.hfadeel.com/Blog/?p=151http://www.hfadeel.com/Blog/?p=151
http://www.hfadeel.com/Blog/?p=151
 
Sql server performance tuning and optimization
Sql server performance tuning and optimizationSql server performance tuning and optimization
Sql server performance tuning and optimization
 
IRJET - The 3-Level Database Architectural Design for OLAP and OLTP Ops
IRJET - The 3-Level Database Architectural Design for OLAP and OLTP OpsIRJET - The 3-Level Database Architectural Design for OLAP and OLTP Ops
IRJET - The 3-Level Database Architectural Design for OLAP and OLTP Ops
 
SQL Explore 2012: P&T Part 1
SQL Explore 2012: P&T Part 1SQL Explore 2012: P&T Part 1
SQL Explore 2012: P&T Part 1
 
How should I monitor my idaa
How should I monitor my idaaHow should I monitor my idaa
How should I monitor my idaa
 
Quick guide to PostgreSQL Performance Tuning
Quick guide to PostgreSQL Performance TuningQuick guide to PostgreSQL Performance Tuning
Quick guide to PostgreSQL Performance Tuning
 
Sap basis made_easy321761331053730
Sap basis made_easy321761331053730Sap basis made_easy321761331053730
Sap basis made_easy321761331053730
 
Movile Internet Movel SA: A Change of Seasons: A big move to Apache Cassandra
Movile Internet Movel SA: A Change of Seasons: A big move to Apache CassandraMovile Internet Movel SA: A Change of Seasons: A big move to Apache Cassandra
Movile Internet Movel SA: A Change of Seasons: A big move to Apache Cassandra
 
Cassandra Summit 2015 - A Change of Seasons
Cassandra Summit 2015 - A Change of SeasonsCassandra Summit 2015 - A Change of Seasons
Cassandra Summit 2015 - A Change of Seasons
 

Recently uploaded

RS 9000 Call In girls Dwarka Mor (DELHI)⇛9711147426🔝Delhi
RS 9000 Call In girls Dwarka Mor (DELHI)⇛9711147426🔝DelhiRS 9000 Call In girls Dwarka Mor (DELHI)⇛9711147426🔝Delhi
RS 9000 Call In girls Dwarka Mor (DELHI)⇛9711147426🔝Delhijennyeacort
 
Beautiful Sapna Vip Call Girls Hauz Khas 9711199012 Call /Whatsapps
Beautiful Sapna Vip  Call Girls Hauz Khas 9711199012 Call /WhatsappsBeautiful Sapna Vip  Call Girls Hauz Khas 9711199012 Call /Whatsapps
Beautiful Sapna Vip Call Girls Hauz Khas 9711199012 Call /Whatsappssapnasaifi408
 
20240419 - Measurecamp Amsterdam - SAM.pdf
20240419 - Measurecamp Amsterdam - SAM.pdf20240419 - Measurecamp Amsterdam - SAM.pdf
20240419 - Measurecamp Amsterdam - SAM.pdfHuman37
 
9654467111 Call Girls In Munirka Hotel And Home Service
9654467111 Call Girls In Munirka Hotel And Home Service9654467111 Call Girls In Munirka Hotel And Home Service
9654467111 Call Girls In Munirka Hotel And Home ServiceSapana Sha
 
毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degreeyuu sss
 
Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)
Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)
Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)jennyeacort
 
Effects of Smartphone Addiction on the Academic Performances of Grades 9 to 1...
Effects of Smartphone Addiction on the Academic Performances of Grades 9 to 1...Effects of Smartphone Addiction on the Academic Performances of Grades 9 to 1...
Effects of Smartphone Addiction on the Academic Performances of Grades 9 to 1...limedy534
 
Predicting Salary Using Data Science: A Comprehensive Analysis.pdf
Predicting Salary Using Data Science: A Comprehensive Analysis.pdfPredicting Salary Using Data Science: A Comprehensive Analysis.pdf
Predicting Salary Using Data Science: A Comprehensive Analysis.pdfBoston Institute of Analytics
 
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...soniya singh
 
专业一比一美国俄亥俄大学毕业证成绩单pdf电子版制作修改
专业一比一美国俄亥俄大学毕业证成绩单pdf电子版制作修改专业一比一美国俄亥俄大学毕业证成绩单pdf电子版制作修改
专业一比一美国俄亥俄大学毕业证成绩单pdf电子版制作修改yuu sss
 
04242024_CCC TUG_Joins and Relationships
04242024_CCC TUG_Joins and Relationships04242024_CCC TUG_Joins and Relationships
04242024_CCC TUG_Joins and Relationshipsccctableauusergroup
 
办理(UWIC毕业证书)英国卡迪夫城市大学毕业证成绩单原版一比一
办理(UWIC毕业证书)英国卡迪夫城市大学毕业证成绩单原版一比一办理(UWIC毕业证书)英国卡迪夫城市大学毕业证成绩单原版一比一
办理(UWIC毕业证书)英国卡迪夫城市大学毕业证成绩单原版一比一F La
 
原版1:1定制南十字星大学毕业证(SCU毕业证)#文凭成绩单#真实留信学历认证永久存档
原版1:1定制南十字星大学毕业证(SCU毕业证)#文凭成绩单#真实留信学历认证永久存档原版1:1定制南十字星大学毕业证(SCU毕业证)#文凭成绩单#真实留信学历认证永久存档
原版1:1定制南十字星大学毕业证(SCU毕业证)#文凭成绩单#真实留信学历认证永久存档208367051
 
Generative AI for Social Good at Open Data Science East 2024
Generative AI for Social Good at Open Data Science East 2024Generative AI for Social Good at Open Data Science East 2024
Generative AI for Social Good at Open Data Science East 2024Colleen Farrelly
 
From idea to production in a day – Leveraging Azure ML and Streamlit to build...
From idea to production in a day – Leveraging Azure ML and Streamlit to build...From idea to production in a day – Leveraging Azure ML and Streamlit to build...
From idea to production in a day – Leveraging Azure ML and Streamlit to build...Florian Roscheck
 
Industrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdfIndustrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdfLars Albertsson
 
GA4 Without Cookies [Measure Camp AMS]
GA4 Without Cookies [Measure Camp AMS]GA4 Without Cookies [Measure Camp AMS]
GA4 Without Cookies [Measure Camp AMS]📊 Markus Baersch
 
Amazon TQM (2) Amazon TQM (2)Amazon TQM (2).pptx
Amazon TQM (2) Amazon TQM (2)Amazon TQM (2).pptxAmazon TQM (2) Amazon TQM (2)Amazon TQM (2).pptx
Amazon TQM (2) Amazon TQM (2)Amazon TQM (2).pptxAbdelrhman abooda
 
B2 Creative Industry Response Evaluation.docx
B2 Creative Industry Response Evaluation.docxB2 Creative Industry Response Evaluation.docx
B2 Creative Industry Response Evaluation.docxStephen266013
 
科罗拉多大学波尔得分校毕业证学位证成绩单-可办理
科罗拉多大学波尔得分校毕业证学位证成绩单-可办理科罗拉多大学波尔得分校毕业证学位证成绩单-可办理
科罗拉多大学波尔得分校毕业证学位证成绩单-可办理e4aez8ss
 

Recently uploaded (20)

RS 9000 Call In girls Dwarka Mor (DELHI)⇛9711147426🔝Delhi
RS 9000 Call In girls Dwarka Mor (DELHI)⇛9711147426🔝DelhiRS 9000 Call In girls Dwarka Mor (DELHI)⇛9711147426🔝Delhi
RS 9000 Call In girls Dwarka Mor (DELHI)⇛9711147426🔝Delhi
 
Beautiful Sapna Vip Call Girls Hauz Khas 9711199012 Call /Whatsapps
Beautiful Sapna Vip  Call Girls Hauz Khas 9711199012 Call /WhatsappsBeautiful Sapna Vip  Call Girls Hauz Khas 9711199012 Call /Whatsapps
Beautiful Sapna Vip Call Girls Hauz Khas 9711199012 Call /Whatsapps
 
20240419 - Measurecamp Amsterdam - SAM.pdf
20240419 - Measurecamp Amsterdam - SAM.pdf20240419 - Measurecamp Amsterdam - SAM.pdf
20240419 - Measurecamp Amsterdam - SAM.pdf
 
9654467111 Call Girls In Munirka Hotel And Home Service
9654467111 Call Girls In Munirka Hotel And Home Service9654467111 Call Girls In Munirka Hotel And Home Service
9654467111 Call Girls In Munirka Hotel And Home Service
 
毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
 
Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)
Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)
Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)
 
Effects of Smartphone Addiction on the Academic Performances of Grades 9 to 1...
Effects of Smartphone Addiction on the Academic Performances of Grades 9 to 1...Effects of Smartphone Addiction on the Academic Performances of Grades 9 to 1...
Effects of Smartphone Addiction on the Academic Performances of Grades 9 to 1...
 
Predicting Salary Using Data Science: A Comprehensive Analysis.pdf
Predicting Salary Using Data Science: A Comprehensive Analysis.pdfPredicting Salary Using Data Science: A Comprehensive Analysis.pdf
Predicting Salary Using Data Science: A Comprehensive Analysis.pdf
 
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
 
专业一比一美国俄亥俄大学毕业证成绩单pdf电子版制作修改
专业一比一美国俄亥俄大学毕业证成绩单pdf电子版制作修改专业一比一美国俄亥俄大学毕业证成绩单pdf电子版制作修改
专业一比一美国俄亥俄大学毕业证成绩单pdf电子版制作修改
 
04242024_CCC TUG_Joins and Relationships
04242024_CCC TUG_Joins and Relationships04242024_CCC TUG_Joins and Relationships
04242024_CCC TUG_Joins and Relationships
 
办理(UWIC毕业证书)英国卡迪夫城市大学毕业证成绩单原版一比一
办理(UWIC毕业证书)英国卡迪夫城市大学毕业证成绩单原版一比一办理(UWIC毕业证书)英国卡迪夫城市大学毕业证成绩单原版一比一
办理(UWIC毕业证书)英国卡迪夫城市大学毕业证成绩单原版一比一
 
原版1:1定制南十字星大学毕业证(SCU毕业证)#文凭成绩单#真实留信学历认证永久存档
原版1:1定制南十字星大学毕业证(SCU毕业证)#文凭成绩单#真实留信学历认证永久存档原版1:1定制南十字星大学毕业证(SCU毕业证)#文凭成绩单#真实留信学历认证永久存档
原版1:1定制南十字星大学毕业证(SCU毕业证)#文凭成绩单#真实留信学历认证永久存档
 
Generative AI for Social Good at Open Data Science East 2024
Generative AI for Social Good at Open Data Science East 2024Generative AI for Social Good at Open Data Science East 2024
Generative AI for Social Good at Open Data Science East 2024
 
From idea to production in a day – Leveraging Azure ML and Streamlit to build...
From idea to production in a day – Leveraging Azure ML and Streamlit to build...From idea to production in a day – Leveraging Azure ML and Streamlit to build...
From idea to production in a day – Leveraging Azure ML and Streamlit to build...
 
Industrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdfIndustrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdf
 
GA4 Without Cookies [Measure Camp AMS]
GA4 Without Cookies [Measure Camp AMS]GA4 Without Cookies [Measure Camp AMS]
GA4 Without Cookies [Measure Camp AMS]
 
Amazon TQM (2) Amazon TQM (2)Amazon TQM (2).pptx
Amazon TQM (2) Amazon TQM (2)Amazon TQM (2).pptxAmazon TQM (2) Amazon TQM (2)Amazon TQM (2).pptx
Amazon TQM (2) Amazon TQM (2)Amazon TQM (2).pptx
 
B2 Creative Industry Response Evaluation.docx
B2 Creative Industry Response Evaluation.docxB2 Creative Industry Response Evaluation.docx
B2 Creative Industry Response Evaluation.docx
 
科罗拉多大学波尔得分校毕业证学位证成绩单-可办理
科罗拉多大学波尔得分校毕业证学位证成绩单-可办理科罗拉多大学波尔得分校毕业证学位证成绩单-可办理
科罗拉多大学波尔得分校毕业证学位证成绩单-可办理
 

Dmv's & Performance Monitor in SQL Server

  • 1. DMVs And Performance Monitor in SQL Server By Zeba Tabassum
  • 2. Agenda Definition DMVs Type DMVs Category Disadvantage Of DMVs Performance Monitor Counters
  • 3. DMV’s Definition Dynamic management views and functions return server state information that can be used to monitor the health of a server instance, diagnose problems, and tune performance. Prior to SQL Server 2005, we had several system tables(for example sysprocesses, syslockinfo etc.) to monitor the state of the system. Though these system tables are still available in SQL Server 2005 and in later versions but SQL Server 2005 introduced whole new set of Dynamic Management Views
  • 4. DMV’s Type There are two types of dynamic management views:- • Server-scoped DMV’s They reside in master database and provide SQL Server instance wide information. To access these DMV we need to have SELECT permission on the objects and VIEW SERVER STATE permission on the server. • Database-scoped DMV’s They reside in each database and provide database wide information. To access these DMV we need to have SELECT permission on the objects and these require VIEW DATABASE STATE permission on the database.
  • 5. Listing DMVs SELECT name AS DMV_Name, [type] AS DMV_Type, type_desc FROM sys.system_objects WHERE name LIKE 'dm_%' ORDER BY name SELECT count(*) TotalDMVCount FROM sys.system_objects WHERE name LIKE 'dm_%'
  • 6.
  • 7. DMVs The most frequently used DMV sections are: • Database • Execution • IO • Index • SQL operating system
  • 9. Database DMVs SELECT TOP 3 object_name(object_id) AS objname, in_row_data_page_count, in_row_reserved_page_count, used_page_count, reserved_page_count, row_count FROM sys.dm_db_partition_stats GO
  • 10.
  • 11. Execution Related DMVs • sys.dm_exec_connections • sys.dm_exec_sessions • sys.dm_exec_requests • sys.dm_exec_cached_plans • sys.dm_exec_query_plans • sys.dm_exec_sql_text • sys.dm_exec_query_stats
  • 12. Execution Related DMVs SELECT session_id, login_name, last_request_end_time, cpu_time FROM sys.dm_exec_sessions WHERE session_id >= 61 GO
  • 13. Execution Related DMVs SELECT connection_id, session_id, client_net_address, auth_scheme FROM sys.dm_exec_connections WHERE session_id >= 61
  • 14.
  • 15.
  • 16. I/O Related DMV’s • sys.dm_io_virtual_file_stats • sys.dm_io_pending_io_requests • sys.dm_io_cluster_shared_drives
  • 17. I/O Related DMV’s --Shows I/O stats for (data and log files) and virtual files no. of read and write SELECT * FROM sys.dm_io_pending_io_requests GO SELECT TOP 5 db_name(database_id) DataBaseName, file_id, num_of_reads, num_of_writes FROM sys.dm_io_virtual_file_stats(NULL, NULL)
  • 18.
  • 19. Index Related DMVs • sys.dm_db_index_physical_stats • sys.dm_db_index_usage_stats • sys.dm_db_index_operational_stats • sys.dm_db_missing_index_details • sys.dm_db_missing_index_groups • sys.dm_db_missing_index_group_stats • sys.dm_db_missing_index_columns
  • 20. Index Related DMVs --- Returns system_scansCounts with different date and objects fragmentation of index operations. -- DECLARE @DBName VARCHAR(50)='testnew' DECLARE @dbid BIGINT-- Database DB Id SET @dbid=DB_ID(@DBName) SELECT @DBName AS DataBaseName, system_scans, last_system_scan FROM sys.dm_db_index_usage_stats WHERE database_id = @dbid
  • 21. Index Related DMVs SELECT @DBName AS DataBaseName, object_id, avg_fragmentation_in_percent, fragment_count FROM sys.dm_db_index_physical_stats (@dbid, NULL, NULL, NULL, NULL) WHERE database_id = @dbid AND fragment_count > 0
  • 22.
  • 23.
  • 24. Operating System Related DMVs • sys.dm_os_performance_counters • sys.dm_os_schedulers • sys.dm_os_nodes • sys.dm_os_waiting_tasks • sys.dm_os_wait_stats
  • 25. Operating System Related DMVs ---Returning cached page count for each database SELECT COUNT(*)AS cached_pages_count, db_name(database_id) AS database_name, database_id FROM sys.dm_os_buffer_descriptors WHERE database_id NOT IN ( 32767, 4, 2, 1,3, 5 ) GROUP BY db_name(database_id), database_id ORDER BY cached_pages_count DESC; GO
  • 26. Operating System Related DMVs --How memory is used overall on the server, and how much memory is available SELECT total_physical_memory_kb, available_physical_memory_kb, total_page_file_kb, system_memory_state_desc FROM sys.dm_os_sys_memory
  • 27.
  • 28. Disadvantages • The biggest disadvantage in my opinion is the data in the DMVs is reset upon SQL restart. So if you are trying to do trending type of reports, you'll need to capture this DMV data on a regular basis to a DW somewhere. DMV data is not guaranteed to be accurate at the time of retrieval. They are updated asynchronously.
  • 29. Performance Monitor Performance Monitor, commonly referred to as PerfMon, is a Microsoft Windows utility that allows us to capture :- statistical information about the hardware environment, operating system, and any applications that expose properties and counters. We will learn how to use System Monitor to gather counters into counter logs, which can be used to troubleshoot system and performance issues.
  • 30. There are five major resource areas that can cause bottlenecks and affect server performance: physical disk, memory, process, CPU, and Network If any of these resources are overutilized, your server or application can become noticeably slow or can even crash.
  • 31. Performance Counters LogicalDisk% Free Space This measures the percentage of free space on the selected logical disk drive. Take note if this falls below 15 percent, you risk running out of free space for the OS to store critical files. One obvious solution here is to add more disk space. PhysicalDisk% Idle Time This measures the percentage of time the disk was idle during the sample interval. If this counter falls below 20 percent, the disk system is saturated. You may consider replacing the current disk system with a faster disk system.
  • 32. Disk Counters PhysicalDiskAvg. Disk Sec/Read :This measures the average time, in seconds, to read data from the disk. PhysicalDiskAvg. Disk Sec/Write:This measures the average time, in seconds, it takes to write data to the disk. PhysicalDiskAvg. Disk Queue Length : This indicates how many I/O operations are waiting for the hard drive to become available. If the value here is larger than the two times the number of spindles, that means the disk itself may be the bottleneck.
  • 33. Memory Counters MemoryCache Bytes :This indicates the amount of memory being used for the file system cache. There may be a disk bottleneck if this value is greater than 300MB. Memory% Committed Bytes in Use:This measures the ratio of Committed Bytes to the Commit Limit—in other words, the amount of virtual memory in use. This indicates insufficient memory if the number is greater than 80 percent. The obvious solution for this is to add more memory.
  • 34. MemoryAvailable Mbytes:This measures the amount of physical memory, in megabytes, available for running processes. If this value is less than 5 percent of the total physical RAM, that means there is insufficient memory, and that can increase paging activity. To resolve this problem, you should simply add more memory. MemoryPages per Second :This measures the rate at which pages are read from or written to disk to resolve hard page faults. If the value is greater than 1,000, as a result of excessive paging, there may be a memory leak.
  • 35. Processor Counters Processor% Processor Time:This measures the percentage of elapsed time the processor spends executing a non-idle thread. If the percentage is greater than 85 percent, the processor is overwhelmed and the server may require a faster processor. Processor% User Time :This measures the percentage of elapsed time the processor spends in user mode. If this value is high, the server is busy with the application. One possible solution here is to optimize the application that is using up the processor resources. SystemProcessor Queue Length This indicates the number of threads in the processor queue. The server doesn't have enough processor power if the value is more than two times the number of CPUs for an extended period of time.
  • 36. Network Counters Network InterfaceBytes Total/Sec : This measures the rate at which bytes are sent and received over each network adapter, including framing characters. The network is saturated if you discover that more than 70 percent of the interface is consumed. For a 100-Mbps NIC, the interface consumed is 8.7MB/sec (100Mbps = 100000kbps = 12.5MB/sec* 70 percent). In a situation like this, you may want to add a faster network card or segment the network. Network InterfaceOutput Queue Length: This measures the length of the output packet queue, in packets. There is network saturation if the value is more than 2. You can address this problem by adding a faster network card or segmenting the network.
  • 37. SQL Server Counters SQLServer: General Statistics – User Connections SQLServer: Memory Manager – Memory Grants Pending SQLServer: SQL Statistics – Batch Requests/sec SQLServer: SQL Statistics – Compilations/sec SQLServer: SQL Statistics – Recompilations/sec SQLServer:BufferManager - Buffer Cache hit ratio This is the percentage of requests serviced by data cache. When cache is properly used, this should be over 90%. The counter can be improved by adding more RAM. SQLServer:Databases,
  • 38. SQL Server Counters SQLServer:Exec Statistics, SQLServer:General Statistics, SQLServer:Latches, SQLServer:Locks– Average Wait Time This counter shows the average time needed to acquire a lock. This value needs to be as low as possible. SQLServer:MemoryManager– Target Server Memory (KB): indicates how much memory SQL Server “wants”. SQLServer:MemoryManager— Total Server Memory (KB): Indicates how much memory SQL Server is actually using. SQLServer:PlanCache SQLServer:Access Methods – Full scans/sec: higher numbers (> 1 or 2) may mean you are not using indexes and resorting to table scans instead.