Are SQL Server timeouts logged?
Asked Answered
C

3

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.

Corticosteroid answered 17/11, 2008 at 10:46 Comment(0)
R
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?

Rooker answered 17/11, 2008 at 10:50 Comment(3)
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.Corticosteroid
as i said profiler trace might cause performance issues if left for a while to run. depending of course on your system load.Demeter
A properly set up trace should roughly consume less than 5% of CPU and resources. This post will show you how: #258406Rooker
A
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:

Allianora answered 28/5, 2014 at 9:16 Comment(0)
D
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.

Demeter answered 17/11, 2008 at 11:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.