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
Can a rule be bound to any column of any data type?
How to delete all rows with truncate table statement in ms sql server?
How to use order by with union operators in ms sql server?
how to determine the service pack currently installed on sql server? : Sql server database administration
Why do we use non clustered index?
What are the disadvantages of primary key and foreign key in SQL?
What is ddl and dml commands?
How to list all stored procedures in the current database using ms sql server?
John exports information periodically from a microsoft sql server database to an oracle database what is the best way to do this?
Explain about Views?
Explain cross join or cartesian product in sql?
How to set database to be read_only in ms sql server?
What action plan is preferred if sql server is not responding?
What are various aggregate functions that are available?
What is difference between temp table and cte?