Vous êtes sur la page 1sur 3

Understanding SQL Performance Counters

SQL Server 2000 does a good job in optimizing using the present hardware setup. But more
often than not it becomes important for DBA's to analyze how healthy SQL Server is from
time to time. No wonder DBAs get paid really good all around the world.
In this article I would list some of the interesting counters you can ping to get the health on
various parameters of SQL Server. These are not the exhaustive list and it is not possible to
enumerate all in one go. Use Perfmon tools to get these parameters logged.
Performance Counter Name
1

10

11

Comments
Value greater than 1 or 2 indicates that we
SQLServer:Access Methods - Full Scans /
are having table / Index page scans. We
sec
need to analyze how this can be avoided.
Interesting counter that can lead us to our
SQLServer:Access Methods - Page
table / index design. This value needs to be
Splits/sec
low as possible.
This gives us the number of times a table
SQLServer:Access Methods - Table Lock
lock was asked for in a second. A high
Escalations/sec
number needs a revisit to the query and the
indexes on the table.
The percentage of pages that were found in
the memory. Higher the value the better.
SQL Server:Buffer Manager - Buffer cache
Preferred around the 90% mark. This
hit ratio
included the availability of the procedure
and the data cache in the system.
This number shows the number of pages
that constitute the SQL data cache. A large
changes in this value indicates the database
SQL Server:Buffer Manager - Database
is swapping cache values from the cache.
pages
We need to either increase the memory of
the system or the max server memory
parameter.
This indicates the number of procedures are
SQL Server:Buffer Manager - Procedure
present in the cache. This is the location
cache pages
where the compiled queries are stored.
This is the number of pages that were
SQL Server:Buffer Manager - Stolen pages stolen from the buffer cache to satisfy other
memory requests.
The ratio between the cache hits and
SQL Server:Cache Manager - Cache hit
misses. This counter is a good indicator of
ratio
our caching mechanism in SQL Server. This
value needs to be high in the system.
The number of currently active transactions
SQL Server:Databases - Active
in the system.
Transactions
The number of times the log files have been
extended. If there is lot of activity in this
SQL Server:Databases - Log growths
counter we need to allocate static and large
enough space for our log files.
This number indicates how active our SQL
SQL Server:Databases - Transactions/sec
Server system is. A higher value indicates

more activity is occurring.


12
13
14
15

16

17
18

19

The number of users currently connected to


the SQL Server.
Number of requests for a type of lock per
SQL Server:Locks - Lock Requests/sec
second.
This is the average wait time in milliseconds
SQL Server:Locks - Average Wait Time
to acquire a lock. Lower the value the
better it is.
SQL Server:Locks - Number of
The number of lock requests that resulted
Deadlocks/sec
in a deadlock.
The amount of memory in KB that the
server is using for query optimization. We
SQL Server:Memory Manager - Optimizer
need to have a steady value in this counter.
Memory
A large variation in the value suggests there
is lot of Dynamic SQL is getting executed.
SQL Server:Memory Manager - Connection Amount of memory in KB used to maintain
the connections.
Memory
The number of times per second that SQL
SQL Server:SQL Statistics - SQL
Server compilations have occurred. This
Compilations/sec
value needs to be as low as possible.
This needs to be nil in our system as much
as possible. A recompile can cause
SQL Server:SQL Statistics - SQL Redeadlocks and compile locks that are not
Compilations/sec
compatible with any locking type.
SQL Server:General Statistics - User
Connections

* Other generic performance counters are not added to this list. This will include
%Processor and Disk monitoring counters. Some of them have been outlined below.

20 Processor - %Processor Time

21 Processor - %Interrupt Time

22 Processor - Processor Queue Length

The percentage of time the processor spent


executing a non-idle thread. This value is
subtracted from the time the processor was
idle 100 percent. This is an indicator to the
overall CPU utilization in the system.
The percentage of time the processor spent
servicing hardware interrupts. This can be
any activity on the server machine. This
needs to be 0 while our testing process.
This counter indicates the number of
threads that are waiting in the processor
queue. It can be also interpreted as the
number of threads that are waiting to be
run by the processor. If this value is greater
than the number of processor then we have
aCPU bottleneck in the system.

23 Processor - Context Switches/sec

24 PhysicalDisk - %Disk Read Time

25 PhysicalDisk - %Disk Write Time

26 PhysicalDisk - Avg. Disk Queue Length

27 Memory - Page Faults/sec

28 Memory - Pages/sec

This is an interesting counter. A typical


context switch occurs when the OS or the
application is forced to change the
executing thread on one processor to
another thread executed on another
processor. This value has to be as small as
possible. Context switches are not
avoidable in multi-processor machines.
Hence any value below 10000 is fine.
Time spent by the disk for read operation.
We can have disk by disk analysis also to
narrow down any read IO bottlenecks.
Time spent by the disk for write operation.
We can have disk by disk analysis also to
narrow down any write IO bottlenecks.
Average number of requests that waited for
the read and write requests in the particular
disk. A high value suggests we have a IO
bottleneck.
Total number of faulted pages handled by
the processor per second. This value needs
to as small as possible.
The number of pages written to disk or
from disk to resolve page faults. This would
be the sum of page reads/sec and page
writes/sec counter.

These are some of the performance counters I depend on while at my work for SQL Server
2000. These performance couters are of ultimate use in our every day activity for SQL
Server health

Vous aimerez peut-être aussi