How can your resolve deadlocks?
Answer Posted / ilgian
Deadlocks occour when two or more processes place a lock on
the same resources and each process waits for the others to
release the lock.
The options to avoid deadlocks are basically the following:
1) always update data in the same order: if process A
updates table t1 and then table t2 and process B updates
table t2 and then table t1 deadlocks can occour. Choose an
order and use it everywhere in your code.
2) issue the commands again when you catch the deadlock
3) always update data before data selection: no other
process will place a lock on the modified records
4) identify the processes that can run with lower deadlock
priority and issue SET DEADLOCK_PRIORITY LOW before these
statements: this will tell SQLServer that the process is a
good candidate for killing in case of deadlock, having
the "important" processes free to run without kills
| Is This Answer Correct ? | 12 Yes | 0 No |
Post New Answer View All Answers
What are the properties of primary key?
what is spatial nonclustered index
Explain what are the database objects? : SQL Server Architecture
How to execute a stored procedure in ms sql server?
System requirements for sql server 2005 express edition?
What is a with(nolock)?
What happens if the update subquery returns multiple rows in ms sql server?
What do you understand by user-defined function in the sql server and explain the steps to create and execute a user-defined function in the sql server?
Different types of keys in SQL?
Explain boyce and codd normal form(bcnf)?
How to find related tables in sql server?
Explain what is the purpose of sql profiler in sql server?
What is difference between table aliases and column aliases? Do they affect performance?
What is data source document?
Can You Use Data Mining Models In Ssrs?