This article is half-done without your Comment! *** Please share your thoughts via Comment ***
In this post, I am sharing the use of sp_monitor which we can use to compare the SQL Server Statistics like CPU usage, Packets received/sent, total read/write for between the different query executions.
The sp_monitor is a very handy and you can note down the exact server usage between your executions.
How can I use?
The usage is straightforward,
First, execute the sp_monitor and save/note down the statistics information (e.g, you executed at 08:08:00)
Next, you can start your execution (e.g, your query took 10 minutes and completed at 08:18:00)
Now, you can execute sp_monitor to check the server statistics for that 10 minutes.
The statistic prints in the form number(number)-number% or number(number).
The number in parentheses refers to the number of seconds or total number since the last time sp_monitor was run. The percentage is the percentage of time since sp_monitor was the last run.For example:
cpu_busy as 8860(626)-70%
the CPU has been busy 8860 seconds since SQL Server was last started up, 626 seconds since sp_monitor was the last run, and 70 percent of the total time since sp_monitor was the last run.
Sample execution:
1 2 |
USE master EXEC sp_monitor |
Sample result:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
last_run current_run seconds ----------------------- ----------------------- ----------- 2017-08-18 12:57:51.687 2017-08-18 12:58:02.427 11 cpu_busy io_busy idle ------------------------- ------------------------- ------------------------- 75462(0)-0% 2084(0)-0% 2913471(9)-81% packets_received packets_sent packet_errors ------------------------ ------------------------ ------------------------ 45941145(68) 48348029(97) 27(0) total_read total_write total_errors connections ------------------- ------------------- ------------------- ------------------ 7819213(220) 5783135(2) 0(0) 7208992(23) |
Aggressive check:
If you want to know about the usage of server statistics for your only single/dedicated execution, I would suggest to set your database in single-user mode and then check using sp_monitor. (This suggestion is only for your test server.)
Leave a Reply