I ran SQL Server Profiler trace (duration on batch complete) and found one really long running query. These are the utilization statistics for the top five longest running queries:
Count Duration CPU Reads Writes
1 1237757030 608 47979 10
14695 358668961 355928 4818709 315
3501 48323496 43705 625474 17
75883 46373094 45250 8526977 127
34 35394031 10200 2461621 0
The first one runs nearly 3 times longer than the second, even though the second has a much larger cumulative CPU time and number of reads than the first one. How could this be, or how can I find out more about what is happening here?
Usually this is caused by some kind resource contention. In other words, your query is idle while waiting for locks to be released (blocking), data to be read from disk, waiting for threads to complete their work etc.
It’s a deep subject, but I would recommend starting by looking at your wait stats.
To get an idea of the cumulitive wait stats, look at sys.dm_os_wait_stats. From BOL:
You can also run your query and attempt to identify issues with blocking. Here’s a good article on the subject.
http://www.simple-talk.com/sql/sql-tools/how-to-identify-blocking-problems-with-sql-profiler/
These are a few areas to look but, honestly there are so many variables that, short of having access to your server, it is incredibly difficult to anything beyond offer guesses and suggestions on where you could look.