16

Are SQL Server timeouts (SELECT queries, in particular) logged in the ERRORLOG file?

Background is a customer with a web site having occasional "Request timeout" messages, looking to me assuming that the timeout is caused by a database timeout. There are no timeout errors in the ERRORLOG in question.

Alex Angas
  • 59,219
  • 41
  • 137
  • 210
Nick Watts
  • 223
  • 1
  • 3
  • 8

3 Answers3

13

No. You will need to use SQL Profiler. A standard trace with the Lock Timeout event and Deadlock Graph events should do it.

Hardware aside (such as enough RAM and fast drives, and appropriate placement of Data and Log files on the appropriate RAID configurations) most timeouts are caused by not having a sufficently 'good' set of indexes for your workload.

Do you have index maintenance plans scheduled regularly?

Mitch Wheat
  • 295,962
  • 43
  • 465
  • 541
  • Thanks for that, I've set a trace going... I don't have regular index maintenance, but I did defrag them last week and the problem is still occurring. – Nick Watts Nov 17 '08 at 11:02
  • as i said profiler trace might cause performance issues if left for a while to run. depending of course on your system load. – Mladen Prajdic Nov 17 '08 at 12:57
  • 2
    A properly set up trace should roughly consume less than 5% of CPU and resources. This post will show you how: http://stackoverflow.com/questions/257906/ms-sql-server-2008-how-can-i-log-and-find-the-most-expensive-queries#257944 – Mitch Wheat Nov 18 '08 at 14:44
6

SQL Server timeouts are initiated from the client-side as Attention Events and are not recorded in the SQL Server Error Log.

You can monitor for Attention Events using:

John Sansom
  • 41,005
  • 9
  • 72
  • 84
3

You could also use Event Notifications that get raised on the timeout and deadlock events. After it fires, you can write it to a table and or send yourself an email.

I've shown the general technique here:

Immediate deadlock notifications without changing existing code

July 18, 2008

This way you don't have to run Profiler; which can impact performance.

Ian Boyd
  • 246,734
  • 253
  • 869
  • 1,219
Mladen Prajdic
  • 15,457
  • 2
  • 43
  • 51