Tips: How to monitor SQL Server Performance and Activity using the built-in functions

We can even find a set of built-in functions that return system information apart from the use of the log files and Transact-SQL statements. In this article, let’s have an overview of the key built-in functions and their usages. The values returned by these functions are cumulative from the time SQL Server was last started.

Function Description Example
@@connections Returns the number of connections or attempted connections select @@connections as ‘Total Login Attempts’
@@cpu_busy Returns CPU processing time in milliseconds for SQL Server activity select @@cpu_busy as ‘CPU Busy’, getdate() as ‘Since’
@@idle Returns SQL Server idle time in milliseconds select @@idle as ‘Idle Time’, getdate() as ‘Since’
@@io_busy Returns I/O processing time in milliseconds select @@io_busy as ‘IO Time’, getdate() as ‘Since’ for SQL Server
@@pack_received Returns the number of input packets read from the network by SQL Server select @@pack_received as ‘Packets Received’

@@pack_sent Returns the number of output packets written to the network by SQL Server select @@pack_sent as ‘Packets Sent’
@@packet_errors Returns the number of network packet errors for SQL Server connections select @@packet_errors as ‘Packet Errors’
@@timeticks Returns the number of microseconds per CPU clock tick select @@timeticks as ‘Clock Ticks’
@@total_errors Returns the number of disk read/write errors encountered by SQL Server select @@total_errors as ‘Total Errors’, getdate() as ‘Since’
@@total_read Returns the number of disk reads by SQL Server select @@total_read as ‘Reads’, getdate() as ‘Since’
@@total_write Returns the number of disk writes by SQL Server select @@total_write as ‘Writes’, getdate() as ‘Since’
fn_virtualfilestats Returns input/output statistics for data and log files select * from fn_virtualfilestats(null,null)

B y

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>