Beruflich Dokumente
Kultur Dokumente
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.
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.
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.
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.
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