473,385 Members | 1,901 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

After SP4, proc w. Cursor doesn't release keylocks

Existing Stored Procedure, has been running well on SQL since 7.0.
(but needed some tweaking to migrate to 2000).

Now all of a sudden after installing SP4 of SQL 2000,
this process slows down, and SQL Spotlight shows the number of locks
just climbing throughout the processing run.

According to the MS Knowledge Base Articles on KeyLocks .. this was a
problem that was *fixed* in the service pack ... where as for me it is
now broken.

Article ID : 260652
PRB: Nested Loop Join That Uses A "BOOKMARK LOOKUP ...WITH PREFETCH"
May Hold Locks Longer http://support.microsoft.com/kb/260652/

Article ID : 828096
FIX: Key Locks Are Held Until the End of the Statement for Rows That
Do Not Pass Filter Criteria http://support.microsoft.com/kb/828096/

Anybody else have this issue, or have any "eazy" solutions?

The proc cursors thru a list and runs a proc on each item in the "work
list".
This is an existing system
with no plans to turn the process into a set oriented one,
as is going away shortly.

Aug 14 '06 #1
4 1484
rawheiser (ra*******@gmail.com) writes:
Now all of a sudden after installing SP4 of SQL 2000,
this process slows down, and SQL Spotlight shows the number of locks
just climbing throughout the processing run.

According to the MS Knowledge Base Articles on KeyLocks .. this was a
problem that was *fixed* in the service pack ... where as for me it is
now broken.

Article ID : 260652
PRB: Nested Loop Join That Uses A "BOOKMARK LOOKUP ...WITH PREFETCH"
May Hold Locks Longer http://support.microsoft.com/kb/260652/

Article ID : 828096
FIX: Key Locks Are Held Until the End of the Statement for Rows That
Do Not Pass Filter Criteria http://support.microsoft.com/kb/828096/

Anybody else have this issue, or have any "eazy" solutions?

The proc cursors thru a list and runs a proc on each item in the "work
list".
This is an existing system with no plans to turn the process into a set
oriented one, as is going away shortly.
It's not clear why think your problem is related to the problem discussed
in the KB article. Apparently, your procedure has a cursor, so there
might be other reasons for these locks.

Is the entire loop one transaction?

As a shot in the dark, if the cursor declaration just says:

DECLARE cur CURSOR FOR

try adding INSENSITIVE before CURSOR.
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Aug 15 '06 #2
It IS an insensitive cursor.

Looking thru DBArtisan I see the KeyLocks in its lock display window,
and in SQL Spotlight I see the number of locks jump by 1000 or so every
few seconds.

How can I monitor what procedure is locking what resource?

Other than injecting some debugging code into the procedures?

Aug 16 '06 #3
rawheiser (ra*******@gmail.com) writes:
It IS an insensitive cursor.
As I said, it was a shot in the dark.
Looking thru DBArtisan I see the KeyLocks in its lock display window,
and in SQL Spotlight I see the number of locks jump by 1000 or so every
few seconds.
And it retains the locks?
How can I monitor what procedure is locking what resource?
Maybe my aba_lockinfo can be of help? If your procedure releases the locks,
then you will have to get the right moment, but if it retains the locks
you will see what it is. You find aba_lockinfo at
http://www.sommarskog.se/sqlutil/aba_lockinfo.html.
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Aug 16 '06 #4
Thanks for the link, I will look at it for future issues.
(and browse about your site for other goodies).

I did find the problem,
though I am not exactly sure of the mechanism involved.

The outer procedure was calling a procedure
that a procedure three levels down was also calling,
when I removed the duplicate updating,
it then flew like the wind.

I also changed a Set NoCount OFF to ON, which may have helped as well.

The proc is called by SQLAgent,
and I'm not exactly sure where all that 'client chatter'
goes to when the server is running the process.
(the NULL device?).

Aug 17 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Rick | last post by:
Package header named RecordSetPKG as follows as --Package defines the type ref cursor stored procedures will use varables of this type to stored --multple records back to the calling stored...
0
by: Rick | last post by:
I wrote a medium length stored proc that uses both temp tables and one cursor. I compiled and it ran fine. However, we reboot our machine every weekend, and on Mondays the stored proc gets the...
10
by: syntego | last post by:
I think I have discovered a bug in the handling of null values (vs NULL values) passed as parameters to a stored proc. I have always believed that the database handled NULL and null the same. ...
0
by: anonieko | last post by:
This approach I found very efficient and FAST when compared to the rowcount, or Subquery Approaches. This is before the advent of a ranking function from DB such as ROW_NUMBER() in SQL Server...
4
by: Alex | last post by:
Hi - I have some code that looks like this: widget_DragDrop(object sender, DragEventArgs e) { //1. some business logic dataobject_changedbvalues()
2
by: V Sudarshan | last post by:
#include <stdio.h> #include <sqlca.h> #include <sqlcpr.h> struct my_vc_ptr { unsigned short len; unsigned char arr; };
1
by: nikki.farrah | last post by:
Hi all, this is my first time posting so any help is appreciated! I am doing a simple AJAX request to our server, and I would like the cursor style changed to 'wait' when the user clicks a button...
10
by: Hendri Adriaens | last post by:
Hi, I'm trying to automate the creation of an excel file via COM. I copied my code below. I read many articles about how to release the COM objects that I create. The code below runs just fine...
22
by: Sri | last post by:
All Recenetly our shop migrated to DB2 V8 from V7. We are in IBM System Level: z/OS 1.6.1 @ RSU 0702. Processor : IBM 2064-1C7 (z/900) # 1B89 Mode: 64-bit One of my application is facing...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.