Site sponsored by: Idera Try Idera’s new SQL admin toolset
SQL Server Performance

  • Home
  • Articles
  • Forums
  • Tips
  • Quiz
  • FAQ's
  • Blogs
  • Software
  • Books
  • About Us
RSS Feeds
Sign in | Join


Article Topics

All Articles
Peformance Tuning
Audit
Business Intelligence
Clustering
Reporting Services
Developer
General DBA
ASP.NET / ADO.NET

SQL Server 2008 - Worth the Wait

SQL Server’s first significant upgrade in three years features a number of envelope-pushing enhancements and improvements. Which will have the greatest impact on SQL administration and development? More...
Latest Articles

Slowly Changing Dimensions in SQL Server 2005
Audit Data Modifications
SQL Server 2008’s Management Data Warehouse
Same Report but Different Methods in SQL Server Reporting Services ...

More     
 
Latest FAQ's

How to Integrate Performance Monitor and SQL Profiler
SSIS Lookups are Case Sensitive
Convert Number to Words in SSRS
After installing SP2 on SQL Server 2005 x64, when trying to ...

More     
   
Latest Software Reviews

SQL Server DBA Dashboard
SwisSQL DBChangeManager
SQLMesh - SQL Server Search Tool
SoftTreeTech SQL Assistant

More     

articles >> peformance tuning >> The “sys.dm_os_performance_counters” Dynamic Management View

The “sys.dm_os_performance_counters” Dynamic Management View

By : Greg Larsen
Nov 13, 2007
Printer friendly

SQL Server 2005 performance can be tracked and monitored by using performance counters.  The performance counters can be displayed by either the System Monitor (PERFMON) tool, or by using the “sys.os_exec_performance_counters” Dynamic Management View (DMV).  This DMV is new with SQL Server 2005.  This article will explore the different counters exposed by this DMV and how you can use this DMV to monitor various performance aspects of SQL Server.

 

sys.os_exec_performance_counters DMV

The “sys.os_exec_performance_counters” DMV, lets you use simple TSQL to obtain different SQL Server performance counters.   This view contains both instance level and database specific counters.  Some counters provided valuable information by themselves, while other counters require you to compare the difference between multiple counters, to obtain a meaningful counter value.  Below is list of the different SQL Server objects available within this DMV.  For each of these objects multiple counters exist:

SQLServer:Buffer Partition
SQLServer:User Settable
SQLServer:Databases
SQLServer:CLR
SQLServer:Cursor Manager by Type
SQLServer:Exec Statistics
SQLServer:Transactions
SQLServer:Memory Manager
SQLServer:SQL Errors
SQLServer:Buffer Node
SQLServer:Plan Cache
SQLServer:Access Methods
SQLServer:Cursor Manager Total
SQLServer:Broker Activation
SQLServer:Latches
SQLServer:Wait Statistics
SQLServer:Broker/DBM Transport
SQLServer:General Statistics
SQLServer:SQL Statistics
SQLServer:Catalog Metadata
SQLServer:Broker Statistics
SQLServer:Locks
SQLServer:Buffer Manage

As you can see, there are quite a few SQL Server objects that contain performance counters, which are exposed by this DMV.  For more information about each of these objects, please refer to the Books Online topic titled “Using SQL Server Object”.

These performance counters were available in SQL Server 2000 by retrieving information from the “master.dbo.sysperfinfo” table.  A view that represents this table has been provided in SQL Server 2005, for backwards compatibility with SQL Server 2000.  This view allows your old SQL Server 2000 code to still work and retrieve information about performance counters.  But as with any backwards compatible feature you should consider re-writing your code to use the new “sys.os_exec_performance_counters” DMV.

 

Examples of how to use sys.dm_os_exec_performance_counters DMV

The “sys.dm_os_exec_performance_counters” DMV can be used to retrieve a number of different SQL Server performance counters.  Depending on what performance information you are trying to retrieve will determine which counters you should use.  In order for you to better understand how to use this DMV let me go through a few examples.

For the first example, let me show you how to use this DMV to calculate the buffer cache hit ratio.  The buffer cache hit ratio value measures how well your pages are staying in the buffer cache.  The closer the buffer cache hit ratio is to 100 % the better your buffer cache is being utilized, and the better performance you will get out of your SQL Server.   Here is how you would use this DMV to calculate the buffer cache hit ratio:

SELECT (a.cntr_value * 1.0 / b.cntr_value) * 100.0 [BufferCacheHitRatio]

FROM (SELECT *, 1 x FROM sys.dm_os_performance_counters  

        WHERE counter_name = 'Buffer cache hit ratio'

          AND object_name = 'SQLServer:Buffer Manager') a  

     JOIN

     (SELECT *, 1 x FROM sys.dm_os_performance_counters  

        WHERE counter_name = 'Buffer cache hit ratio base'

          and object_name = 'SQLServer:Buffer Manager') b .style1 { width: 615px; } .style2 { text-align: right; width: 85px; }


Comments:
Your Name  
Email    
(Emails will not be displayed on the site or used for promotional purposes)
Comment  


Type characters in the image
 
 (case sensitive)

 
 
 

        








Home | Peformance Articles | Audit Articles | Business Intelligence Articles | Clustering Articles | Developer Articles | Reporting Services Articles | DBA Articles | ASP.NET / ADO.NET Articles | DBA FAQ's | Developer Peformance FAQ's | DBA Peformance FAQ's | Developer FAQ's | Clustering FAQ's | Error Messages | Audit Tool Reviews | Backup Tool Reviews | Coding Tool Reviews | Compare Tool Reviews | Documentation Tool Reviews | Design Tool Reviews | Monitoring Tool Reviews | Log Tool Reviews | Reporting Tool Reviews | Clustering Tool Reviews | Security Tool Reviews | Change Management Tool Reviews | Remote Access Tool Reviews | Book Reviews | Security Tool Reviews | QDPMA Performance Tuning | ADO.NET / ASP.NET | Administration | Analysis/OLAP Services | Application Development | Configuration | Components | ETL | Hardware | High Availability | Hints | Index | Misc | Operating Systems | Performance Tuning | Replication | T-SQL | Views