BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Deadlocks in SQL Server 2000

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (SQL Servers)
View previous topic :: View next topic  
Author Message
Suj
Guest





PostPosted: Fri Apr 15, 2005 2:23 pm    Post subject: Deadlocks in SQL Server 2000 Reply with quote



We are running into a situation where the customers are getting many
deadlock errors. To troubleshoot the problem I set up a trace in sql
profiler and on analysing the trace file I noticed that each time the
deadlock is caused by an update staement on Table A and a select statement
on table A. It is always the same update and select statement. I am not sure
if I understand how a select and an update statement on the same table can
cause a deadlock.

Anyways to resolve the issue quickly I am going to add error handling to
trap the deadlock error and then instead of displaying the deadlock error I
would resubmit the select statement to SQL server again.

I was wondering if any of you could explain what could be the cause of this
deadlock and if there was a better way to handle this situation.

Thanks


Back to top
Patrick
Guest





PostPosted: Fri Apr 15, 2005 2:50 pm    Post subject: Re: Deadlocks in SQL Server 2000 Reply with quote



Quote:
Anyways to resolve the issue quickly I am going to add error handling to
trap the deadlock error and then instead of displaying the deadlock error
I would resubmit the select statement to SQL server again.
I was wondering if any of you could explain what could be the cause of
this deadlock and if there was a better way to handle this situation.

Make sure you use the WITH (NOLOCK) directive on your selects (including
joins.)



Back to top
Thomas Steinmaurer
Guest





PostPosted: Sat Apr 16, 2005 9:30 am    Post subject: Re: Deadlocks in SQL Server 2000 Reply with quote



Quote:
Anyways to resolve the issue quickly I am going to add error handling to
trap the deadlock error and then instead of displaying the deadlock error
I would resubmit the select statement to SQL server again.
I was wondering if any of you could explain what could be the cause of
this deadlock and if there was a better way to handle this situation.


Make sure you use the WITH (NOLOCK) directive on your selects (including
joins.)

The problem with NOLOCK is that Dirty Reads (seeing uncommitted changes)
are allowed. Probably something one wants to avoid.


--
Best Regards,
Thomas Steinmaurer
LogManager Series - Logging/Auditing Suites supporting
InterBase, Firebird, Advantage Database, MS SQL Server and
NexusDB V2 (NEW!)
Upscene Productions
http://www.upscene.com


Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (SQL Servers) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.