Wednesday, May 12, 2021

How to get transaction per second in SQL Server

 


DECLARE @Counter bigint

SELECT @Counter = cntr_value FROM sys.dm_os_performance_counters

WHERE counter_name = 'Transactions/sec'

AND object_name='SQLServer:Databases'

AND instance_name ='eTrace'--Your DB Name


-- Wait for 1 second


WAITFOR DELAY '00:00:01'


SELECT cntr_value - @Counter FROM sys.dm_os_performance_counters

WHERE counter_name ='Transactions/sec'

AND object_name ='SQLServer:Databases'

AND instance_name ='eTrace'--Your DB Name

No comments:

Post a Comment