Database Research & Development

  • Home
  • NoSQL
    • NoSQL
    • Cassandra
  • Databases
    • Database Theory
    • Database Designing
    • SQL Server Coding Standards
    • SQL Server
    • PostgreSQL
    • MySQL
    • Greenplum
    • Linux
  • Interviews
    • SQL Server Interviews
    • MySQL Interviews
    • SQL Puzzles
  • DBA Scripts
    • SQL Server DBA Scripts
    • PostgreSQL DBA Scripts
    • MySQL DBA Scripts
    • Greenplum DBA Scripts
  • Home
  • Blog Archives !
  • (: Laugh@dbrnd :)
  • Contact Me !
sqlserverinterviews
Home 2017 August SQL Server: sp_monitor to compare the server statistics for different executions

SQL Server: sp_monitor to compare the server statistics for different executions

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.)

Aug 30, 2017Anvesh Patel
SQL Puzzle: SQL Advance Query - Use PARSENAME() and Sort the IP-AddressesSQL Server 2016: Generate the JSON formatted data from the Table Data

Leave a Reply Cancel reply

CAPTCHA
Refresh

*

Anvesh Patel
Anvesh Patel

Database Engineer

August 30, 2017 SQL ServerAnvesh Patel, cpu_busy, database, database research and development, dbrnd, sp_monitor, SQL Query, SQL Server, SQL Server Administrator, SQL Server Error, SQL Server Monitoring, SQL Server Performance Tuning, SQL Server Programming, SQL Server Tips and Tricks, TSQL
About Me!

I'm Anvesh Patel, a Database Engineer certified by Oracle and IBM. I'm working as a Database Architect, Database Optimizer, Database Administrator, Database Developer. Providing the best articles and solutions for different problems in the best manner through my blogs is my passion. I have more than six years of experience with various RDBMS products like MSSQL Server, PostgreSQL, MySQL, Greenplum and currently learning and doing research on BIGData and NoSQL technology. -- Hyderabad, India.

About DBRND !

dbrnd

This is a personal blog (www.dbrnd.com).

Any views or opinions represented in this blog are personal and belong solely to the blog owner and do not represent those of people, institutions or organizations that the owner may or may not be associated with in professional or personal capacity, unless explicitly stated.

Feel free to challenge me, disagree with me, or tell me I’m completely nuts in the comments section of each blog entry, but I reserve the right to delete any comment for any reason whatsoever (abusive, profane, rude, or anonymous comments) - so keep it polite.

The content of this website is protected by copyright. No portion of this website may be copied or replicated in any form without the written consent of the website owner.

Recent Comments !
  • Anvesh Patel { Sure will do... } – May 27, 12:43 PM
  • Anvesh Patel { Great... } – May 27, 12:41 PM
  • Anvesh Patel { Great... } – May 27, 12:39 PM
  • Anvesh Patel { Great... } – May 27, 12:36 PM
  • Anvesh Patel { Great... } – May 27, 12:28 PM
  • Anvesh Patel { Great... } – May 27, 12:27 PM
  • Anvesh Patel { Great... } – May 27, 12:16 PM
  • Older »
Follow Me !
  • facebook
  • linkedin
  • twitter
  • youtube
  • google
  • flickr
© 2015 – 2019 All rights reserved. Database Research & Development (dbrnd.com)
Posting....