all groups > sql server programming > august 2007 >
You're in the

sql server programming

group:

Row-level locks not working as expected



Row-level locks not working as expected Eaton
8/20/2007 9:08:04 PM
sql server programming: Hi, I have tried using row-level locks to avoid different processes from
blocking each other, but when viewed in Enterprise Mgr, thet are still
showing up as page level locks and there is some serious blocking going on.
My process was even blocking itself??? One of my stored procs has multiple
updates and inserts and I specifed "with (pagelock)" --which seems to have
been overridden.

I've read other similar articles from other othwer there, but am looking for
some helpful solutions to avoid th process blocking. Any ideas?

Thanks.
Re: Row-level locks not working as expected Eaton
8/20/2007 10:32:03 PM
Hi,

You make a good point about long running transactions, but most of the
updates that I am doing need to be all committed or all rolled back, so how
woulld I break this up?
Isn't there some way of having long transactions with multiple updates that
would not seriously block other processes?
Also what is "BTW"?

Thanks.
Greg

[quoted text, click to view]
Re: Row-level locks not working as expected Uri Dimant
8/21/2007 12:00:00 AM
Eaton

Try to put them at the end of transaction. Make sure that you have a
properly desined inedexs
Blocking shows up when one connection locks one or more rows, and a second
connection requires a conflicting lock type on the row/s locked by the first
one
A certain amount of blocks is normal and you cannot avoid them.
http://support.microsoft.com/default.aspx?scid=kb;en-us;Q271509



BTW ---By the Way :-)



[quoted text, click to view]

Re: Row-level locks not working as expected The DBA
8/21/2007 12:00:00 AM
Hi Eaton,

Lock hints are good for workarounds, but do not solve the underlying
problem(s).

I suggest you try out SQL Deadlock Detector. It monitors your database for
locks and deadlocks and provides complete information on captured events. It
tells you everything you need to know (locked objects, blocked statements,
blocking statements, etc.) to solve your blocking/deadlock problems. The
great thing about this tool is it's event diagram which makes it exremely
easy to see and understand what exactly is going on.

You can download it from here:
http://lakesidesql.com/downloads/DLD2/2_0_2007_809/DeadlockDetector2_Setup_08-09-2007.zip.

HTH.



[quoted text, click to view]
Re: Row-level locks not working as expected Uri Dimant
8/21/2007 7:44:41 AM
Eaton
[quoted text, click to view]

Avoid using INSERTING/UPDATING large numbers of records in a single
transaction. Long running queries could be good candidates for blocking.
BTW Row-level locking SQL Server uses by default.

[quoted text, click to view]

Perhaps the followng link might help you
http://support.microsoft.com/kb/906344





[quoted text, click to view]

AddThis Social Bookmark Button