Created
April 18, 2022 12:52
-
-
Save kr153/e92b2d274853cd66d566298d0969cc73 to your computer and use it in GitHub Desktop.
get the number of batch executions per time period
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- First PASS | |
| DECLARE @First INT | |
| DECLARE @Second INT | |
| SELECT @First = cntr_value | |
| FROM sys.dm_os_performance_counters | |
| WHERE | |
| OBJECT_NAME = 'SQLServer:SQL Statistics' AND -- Change name of your server ' AND -- Change name of your server | |
| counter_name = 'Batch Requests/sec'-- AND | |
| --instance_name = 'XC21801'; -- Change name of your database | |
| -- Following is the delay | |
| WAITFOR DELAY '00:01:00' | |
| -- Second PASS | |
| SELECT @Second = cntr_value | |
| FROM sys.dm_os_performance_counters | |
| WHERE | |
| OBJECT_NAME = 'SQLServer:SQL Statistics' AND -- Change name of your server | |
| counter_name = 'Batch Requests/sec' --AND | |
| --instance_name = 'XC21801'; -- Change name of your database | |
| SELECT (@Second - @First) 'TotalTransactions' | |
| GO | |
| --SQLServer:SQL Statistics | |
| --Batch Requests/sec | |
| --select * from sys.dm_os_performance_counters order by counter_name |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment