Sie sind auf Seite 1von 3

Performance tuning steps:

My job or query till yesterday was running for 5 minutes, but today it is taking more
than one hour. Where do you troubleshoot and how do you resolve?

1: Finding the system resources utilization (Like RAM, CPU and DISK I/O)
sp_who2
Above command will display cpu and disk I/O utilization along with last started
query time for every transaction on the server. Based on these statistics we can find
which transaction causing the issue at that moment.
Select * from sysprocesses where spid>50
Above command will display CPU, DISK I/O, and memory utilization along with last
started query time. Based on these output we can easily identify which transaction
occupying the system resources. hatever the transaction are using the most of
these resources are causing the performance issue at that time.
Step 2: Finding the blocking on the server.
sp_who2
Above command will display blocked transaction in blocked by column.
Select * from sysprocesses where blocked <> 0

Above command will display only blocked transaction at that moment on the
server. If there are any blocking that may causing the performance issue May be
could more deadlocks on the server.

Step 3: Finding the resource utilization in task manager.


In task manager in processes section we can find each resources utilization like
Memory and cpu. If any other processes using more Ram and CPU those are the
culprits which are performance issue on the server at that moment.

Step 4: Finding the indexes fragmentation


dbcc showcontig

Above command will display each table scan density values. If the scan density
values between 70% to 100% then we will re-organize indexes followed by update

stats, if scan density value is below 70% then we will rebuild the indexes to improve
the database performance.

Select * from sys.dm_db_index_physical_stats(null,null,null,null,null)

Above command will display each index level fragmentation on the tables of the
database. If the index fragmentation is 1 to 30 then we will re-organize the indexes
followed by update stats. If the fragmentation of the indexes more than 30% then
we will rebuild the indexes to improve the database performance.

Step 5: Finding the long running transactions on the server


Dbcc opentran
Above will display all the oldest active transaction the databases, through which
we can identify what are the transactions are running for longer time and cauing the
performance issue on the server at that time.

Select * from sys.dm_tran_active_snapshot_database_transactions

Above query will display long running transactions related to mirroring,


replication and snapshot isolation transaction at the moment on the server.

Step 6: Finding tempdb utilization


dbcc showfilestats

Above command will display total extents present and total extents utilized at the
moment in tempdb. Based on this we can find tempdb free space.
select * from sys.dm_db_file_space_usage

Above command will display user object reserved page count and system object
reserved page count. Based on this we can identify either user or system session
causing the on the tempdb.

Step 7: Type of operating system.

If the 32 bit operating system sql server can use upto 2 gb of RAM by default. Which
may also create performance issue.

Step 8: Server configuration itself may not correct like configuring max server
memory and configuring tempdb.
Step 9: Network itself could be cause because of insufficient bandwidth between the
server and application.
Step 10: Application itself could be the cause because bad design of the
applications.
Most useful Perfmon counters:
1)processor time
2)Disk reads
3)Disk writes
4)buffer cache hit ratio
5)page life expectancy

Das könnte Ihnen auch gefallen