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


12345»»»

Deadlocks Expand / Collapse
Author
Message
Posted Tuesday, July 08, 2008 8:36 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Today @ 6:36 AM
Points: 382, Visits: 2,069
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 08, 2008 9:39 AM
Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: Thursday, March 04, 2010 2:06 PM
Points: 594, Visits: 554
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)
Post #530141
Posted Tuesday, July 08, 2008 9:43 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Friday, October 03, 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 08, 2008 10:11 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 9:26 AM
Points: 16,948, Visits: 12,087
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

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

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


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 9:26 AM
Points: 16,948, Visits: 12,087
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

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

Post #530181
Posted Tuesday, July 08, 2008 10:15 AM
Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: Thursday, March 04, 2010 2:06 PM
Points: 594, Visits: 554
Check the ISOLATION LEVELS for more info.
Post #530184
Posted Tuesday, July 08, 2008 10:48 PM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Today @ 6:36 AM
Points: 382, Visits: 2,069
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 09, 2008 7:04 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Thursday, March 04, 2010 1:33 PM
Points: 1,143, Visits: 485
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 09, 2008 7:50 AM
Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: Thursday, March 04, 2010 2:06 PM
Points: 594, Visits: 554
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.
Post #530815
Posted Wednesday, July 09, 2008 7:59 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 6:31 AM
Points: 19,977, Visits: 13,576
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."

For better, quicker answers, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/

For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
Post #530832
« Prev Topic | Next Topic »

12345»»»

Permissions Expand / Collapse