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 sub report data source be different from that of the parent report?
Give a example to search fr a string in all stored procedure in sql server.
What are various aggregate functions that are available?
How to find tables without indexes?
How to connect a database with sql express.?
What are four major operators that can be used to combine conditions on a where clause?
How do I start sql server 2016?
Tell me time data type, datetime2, datetimeoffset data type in sql server 2008?
How to store and query spatial data?
What is the user of Primary key?
What is difference between order by and group by?
How use inner join in sql server?
what’s the difference between Covering Indexes and Clustered Indexes ? how to use clustered index small ?
What is the sql case statement used for? Explain with an example?
How to connect sql server management studio express to sql server 2005 express?