SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Deadlocks


Deadlocks

Author
Message
Suresh B.
Suresh B.
SSCrazy
SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)

Group: General Forum Members
Points: 2554 Visits: 5326
Is it possible to have 0 deadlocks in a busy multiuer system?
Is it normal to have around 10 deadlocks daily?
Please share your experiences.
MannySingh
MannySingh
SSCommitted
SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)

Group: General Forum Members
Points: 1609 Visits: 787
What do you mean by 0 Deadlocks...
According to my MEAN Knowledge, if it is NO (0) deadlocks.. yes it is always possible and Good to have NO Deadlocks...on a SQL Server system.
This means your system is not highly transactional Or is very well maintained:::: i.e. Database is normalized and All Queries are using proper HINTS and your server settings are optimized.
Correct me if i am WRONG.
if you see a deadlock that is in place for a long time, make sure, it is not running a HUGE Query.. then kill the SPID associated with it...
(Before taking this step.. make sure the SPID is not performing any Data Changes in the DB)

Maninder
www.dbanation.com
sqlservercenter-793614
sqlservercenter-793614
Valued Member
Valued Member (61 reputation)Valued Member (61 reputation)Valued Member (61 reputation)Valued Member (61 reputation)Valued Member (61 reputation)Valued Member (61 reputation)Valued Member (61 reputation)Valued Member (61 reputation)

Group: General Forum Members
Points: 61 Visits: 92
if a deadlock block your system too long time,then delete it.


MCDBA, MCITP (DB Dev, DB Admin), MCSE,MCTS, OCA 10g
GilaMonster
GilaMonster
SSC Guru
SSC Guru (118K reputation)SSC Guru (118K reputation)SSC Guru (118K reputation)SSC Guru (118K reputation)SSC Guru (118K reputation)SSC Guru (118K reputation)SSC Guru (118K reputation)SSC Guru (118K reputation)

Group: General Forum Members
Points: 118562 Visits: 45545
Mani Singh (7/8/2008)
if you see a deadlock that is in place for a long time, make sure, it is not running a HUGE Query.. then kill the SPID associated with it...
(Before taking this step.. make sure the SPID is not performing any Data Changes in the DB)


sqlservercenter (7/8/2008)
if a deadlock block your system too long time,then delete it.


You don't ever have to worry about killing processes involved in a deadlock. SQL has a deadlock detector built in, if it detects an unresolvable locking condition (a deadlock) it will pick one of the processes involved and automatically kill it.

Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass


GilaMonster
GilaMonster
SSC Guru
SSC Guru (118K reputation)SSC Guru (118K reputation)SSC Guru (118K reputation)SSC Guru (118K reputation)SSC Guru (118K reputation)SSC Guru (118K reputation)SSC Guru (118K reputation)SSC Guru (118K reputation)

Group: General Forum Members
Points: 118562 Visits: 45545
Suresh B. (7/8/2008)
Is it possible to have 0 deadlocks in a busy multiuer system?
Is it normal to have around 10 deadlocks daily?


It is not normal to have 10 deadlocks a day on any system, 0 is what you want and it is not impossible to achieve.
If you have frequent deadlocks then you either have badly written SQL code, poor indexes or both.

Enable traceflag 1204 OR 1222 to get the deadlock graph written into the error log. That should help you locate the queries involved in the deadlock.

Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass


MannySingh
MannySingh
SSCommitted
SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)

Group: General Forum Members
Points: 1609 Visits: 787
Check the ISOLATION LEVELS for more info.

Maninder
www.dbanation.com
Suresh B.
Suresh B.
SSCrazy
SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)

Group: General Forum Members
Points: 2554 Visits: 5326
Mani Singh (7/8/2008)
(0) deadlocks.. yes it is always possible
... is very well maintained:::: i.e. Database is normalized...


GilaMonster (7/8/2008)
It is not normal to have 10 deadlocks a day on any system, 0 is what you want and it is not impossible to achieve.
If you have frequent deadlocks then you either have badly written SQL code, poor indexes or both.


This is what I was looking for.

Thanks Gail Shaw and Mani Singh.
Anders Pedersen
Anders Pedersen
SSCrazy
SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)

Group: General Forum Members
Points: 2110 Visits: 892
When I started in my current job, they had upwards of 120 deadlocks a day..... If I had know that before I accepted the job..... Let's just say it was very indicative of some issues.

I have gotten it down to about 6-7 per day at this point, and those that are left are trapped, since I started trapping them for a couple of stored procedures they have not affected the client. Unfortunatly rewriting the code so they do not happen is just about impossible at this point. But I am looking into it =)

THe main thing that solved the problem here was actually to put an index on a lookup table.... Go figure!
MannySingh
MannySingh
SSCommitted
SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)

Group: General Forum Members
Points: 1609 Visits: 787
Adding to Anders.
My Current job, there is a Application "Maximo" which deals with SHOP Floor Order Entry system. There are 100 People in the Steel Mill loggin into the application through CITRIX, which come down the Database and they generate Huge amount of Deadlocks/locking/blocking Scenarios Daily.. I have check them to use HINTS in their SQL Reports and Application CODE. Also WOrked aound ISOLATION LEVELS.. and SEPRATED their READONLY Data from READ/WRITE using FileGroups and also Seprated their REPORTs to USE, a logged shipped version of Database.. which gets updated twice daily... This is SQL server 2000 SP4.

Maninder
www.dbanation.com
Jeff Moden
Jeff Moden
SSC Guru
SSC Guru (118K reputation)SSC Guru (118K reputation)SSC Guru (118K reputation)SSC Guru (118K reputation)SSC Guru (118K reputation)SSC Guru (118K reputation)SSC Guru (118K reputation)SSC Guru (118K reputation)

Group: General Forum Members
Points: 118521 Visits: 41480
I'm with Gail... but a bit more stringent on the subject. If you have any deadlocks, something is wrong in the code somewhere and you need to fix it. Finding the cause can sometimes be a bit troubling but everytime you have a deadlock, there's a rollback which takes time and that also possibly means some lost data. Finding and repairing code that causes deadlocks should be a top priority for every DBA.

--Jeff Moden

RBAR is pronounced ree-bar and is a Modenism for Row-By-Agonizing-Row.
First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.
If you think its expensive to hire a professional to do the job, wait until you hire an amateur. -- Red Adair

Helpful Links:
How to post code problems
How to post performance problems
Forum FAQs
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search