Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 12345»»»

Deadlocks Expand / Collapse
Author
Message
Posted Tuesday, July 8, 2008 8:36 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Tuesday, September 23, 2014 2:53 AM
Points: 1,101, Visits: 5,290
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.
Post #530084
Posted Tuesday, July 8, 2008 9:39 AM
SSChasing Mays

SSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing Mays

Group: General Forum Members
Last Login: Friday, August 15, 2014 11:42 AM
Points: 646, Visits: 732
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
Post #530141
Posted Tuesday, July 8, 2008 9:43 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Friday, October 3, 2008 2:04 PM
Points: 23, Visits: 92
if a deadlock block your system too long time,then delete it.


MCDBA, MCITP (DB Dev, DB Admin), MCSE,MCTS, OCA 10g
Post #530147
Posted Tuesday, July 8, 2008 10:11 AM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Today @ 2:44 AM
Points: 40,179, Visits: 36,582
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 2008, MVP
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

Post #530174
Posted Tuesday, July 8, 2008 10:14 AM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Today @ 2:44 AM
Points: 40,179, Visits: 36,582
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 2008, MVP
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

Post #530181
Posted Tuesday, July 8, 2008 10:15 AM
SSChasing Mays

SSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing Mays

Group: General Forum Members
Last Login: Friday, August 15, 2014 11:42 AM
Points: 646, Visits: 732
Check the ISOLATION LEVELS for more info.

Maninder
www.dbanation.com
Post #530184
Posted Tuesday, July 8, 2008 10:48 PM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Tuesday, September 23, 2014 2:53 AM
Points: 1,101, Visits: 5,290
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.
Post #530481
Posted Wednesday, July 9, 2008 7:04 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Thursday, October 9, 2014 11:33 AM
Points: 1,307, Visits: 779
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!

Post #530738
Posted Wednesday, July 9, 2008 7:50 AM
SSChasing Mays

SSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing Mays

Group: General Forum Members
Last Login: Friday, August 15, 2014 11:42 AM
Points: 646, Visits: 732
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
Post #530815
Posted Wednesday, July 9, 2008 7:59 AM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 12:08 AM
Points: 35,366, Visits: 31,901
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."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #530832
« Prev Topic | Next Topic »

Add to briefcase 12345»»»

Permissions Expand / Collapse