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

sql server programming

group:

Performance issue running a batch


Performance issue running a batch Sakthi
5/3/2007 10:47:01 PM
sql server programming:
I have a table "Alert" which has millions of records, i need loop thru all
the records using cursor and update the records. While running the batch, the
table is locked.



--
Sakthivel
SQL Server Developer
Re: Performance issue running a batch Erland Sommarskog
5/4/2007 12:00:00 AM
Sakthi (Sakthi@discussions.microsoft.com) writes:
[quoted text, click to view]

I'd be interest to hear why think you need to loop through the table.
Looping over a table of that size must take ages. If you can find a set-
based solution, you may be able to speed up the process considerably.

If you insist on keeping the cursor solution, make the cursor INSENSITIVE or
STATIC. I believe that should resolve the locking issue.


--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
Re: Performance issue running a batch Robert Klemme
5/4/2007 12:00:00 AM
[quoted text, click to view]

As always: more details give better answers. Start with the DB version,
table DDL and at least a textual description of the change you want to make.

AddThis Social Bookmark Button