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


Please Help Members By Posting Answers For Below Questions

What are number line correlation administrators will use while working with a subquery?

626


in a table is b in column k (manikanta,sivananda,muralidhar) i want result like (mnikanta,sivnanda,murlidhar) please slove it

1055


How to include date and time values in sql statements?

630


What is the purpose of object explorer and its features? : sql server management studio

600


What does set rowcount do?

513






Explain what role entity and relationship play in an ER diagram.

578


What is a result set object returned by odbc_exec()?

552


Explain magic tables in sql server?

551


What is the use of builtinadministrators group in sql server? : sql server security

535


Define Unique Key?

594


How to concatenate two strings in SQL Server.

597


How to attach adventureworkslt physical files to the server?

633


How to execute a sql statement using odbc_exec()?

574


What is difference between delete & truncate commands?

550


What are the dmvs?

572