AboutSQL Server, Analytics, .Net, Machine Learning, R, Python Archives
About Me
Mitch Wheat has been working as a professional programmer since 1984, graduating with a honours degree in Mathematics from Warwick University, UK in 1986. He moved to Perth in 1995, having worked in software houses in London and Rotterdam. He has worked in the areas of mining, electronics, research, defence, financial, GIS, telecommunications, engineering, and information management. Mitch has worked mainly with Microsoft technologies (since Windows version 3.0) but has also used UNIX. He holds the following Microsoft certifications: MCPD (Web and Windows) using C# and SQL Server MCITP (Admin and Developer). His preferred development environment is C#, .Net Framework and SQL Server. Mitch has worked as an independent consultant for the last 10 years, and is currently involved with helping teams improve their Software Development Life Cycle. His areas of special interest lie in performance tuning |
Wednesday, January 26, 2011SQL Server 2008 ‘…/sec’ Performance CountersSQL Server contains many Dynamic Management Views (DMV) for diagnosing server activity and health, including one for examining performance counters, sys.dm_os_performance_counters. Some of the counters in "sys.dm_os_performance_counters" with names ending with ‘/sec’ (such as like "Page lookups/sec", or "Page writes/sec") are known as "per second" counters. When you first come across this DMV you might not realise that the values for these counters are cumulative and require two measurements over an interval and then calculating the difference in those values based on the time between the two measurements. Here is a simple TSQL snippet to perform this calculation for all per second counters in sys.dm_os_performance_counters: -- Get first sample Here is a Table valued function version which accepts an interval parameter, and is easy to filter: IF OBJECT_ID(N'dbo.PerSecondPerformanceCounters', N'TF') IS NOT NULL INSERT INTO @tempTable1 declare @start datetime = getdate()Here is how you would call it:
-- Return only per second counters with non-zero values |
ContactMSN, Email: mitch døt wheat at gmail.com LinksFavorites
Blogs |