Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Lock_timeout = -1

Posted on 2010-11-11
2
Medium Priority
?
371 Views
Last Modified: 2012-05-10
Current our sql2005 setting has lock time out = -1,, If I increase this values to maybe 2400 will it reduce db deadlock occurrence ?
0
Comment
Question by:motioneye
2 Comments
 
LVL 75

Accepted Solution

by:
Aneesh Retnakaran earned 1000 total points
ID: 34117864
SET LOCK_TIMEOUT allows an application to set the maximum time that a statement waits on a blocked resource. When a statement has waited longer than the LOCK_TIMEOUT setting, the blocked statement is automatically canceled, and an error message is returned to the application.

At the beginning of a connection, @@LOCK_TIMEOUT returns a value of -1.

Examples
This example shows the result set when a LOCK_TIMEOUT value is not set.

SELECT @@LOCK_TIMEOUT
Here is the result set:

----------------
-1
This example sets LOCK_TIMEOUT to 1800 milliseconds, and then calls @@LOCK_TIMEOUT.

SET LOCK_TIMEOUT 1800
0
 
LVL 6

Assisted Solution

by:subhashpunia
subhashpunia earned 1000 total points
ID: 34119296
It could resuce the deadlock but not solve your altimate problem because it would cancel more transaction than deadlock.
Better way is to identify the processes that commonly deadlocked. Lock duration is not directly proportional to deadlock (even longer lock duration it increases the probability). So setting the @@LOCK_TIMEOUT does not gaurantee to resolve the deadlock.
To know more about the deadlock error and its fix please check this post:

http://blog.sqlauthority.com/2007/05/16/sql-server-fix-error-1205-transaction-process-id-was-deadlocked-on-resources-with-another-process-and-has-been-chosen-as-the-deadlock-victim-rerun-the-transaction/
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
Microsoft Access has a limit of 255 columns in a single table; SQL Server allows tables with over 255 columns, but reading that data is not necessarily simple.  The final solution for this task involved creating a custom text parser and then reading…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

971 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question