Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
SQL Server 7,2000
»
Strategies
»
updating 1,000 records takes 5-6 minutes I...
25 posts, Page 1 of 3
1
2
3
»
»»
updating 1,000 records takes 5-6 minutes I would like to decrease the time that takes
Rate Topic
Display Mode
Topic Options
Author
Message
itsmeman
itsmeman
Posted Tuesday, January 05, 2010 7:02 AM
SSC Rookie
Group: General Forum Members
Last Login: Thursday, January 27, 2011 9:06 AM
Points: 25,
Visits: 64
hello,
i know this says sql 2005.. but the platform I am running on is sql 2000.
i have a database with 1.17 million records.
I need to make a change to 131,000 of these records.
The best way determined to handle this change is through a cursor.
To update 1,000 records it takes 5-6 minutes. I think this is unacceptable because to update 131,000 records it will take roughly 11 hours.
Being new to table and performance handling, can someone direct me in the right direction to decrease the amount of time it takes to update 1,000 records?
thanks.
joshua
Post #842057
GilaMonster
GilaMonster
Posted Tuesday, January 05, 2010 7:21 AM
SSC-Dedicated
Group: General Forum Members
Last Login: Today @ 3:35 PM
Points: 38,062,
Visits: 30,357
Please post SQL 2000 questions in the SQL 2000 forums in the future.
Please post table definitions, sample data and desired output. Read this to see the best way to post this to get quick responses.
http://www.sqlservercentral.com/articles/Best+Practices/61537/
Shouldn't be any need for a cursor here. Of course, without seeing what you want to update and to what, it's hard to say for sure.
Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild
: Discussions on DB performance with occasional diversions into recoverability
We walk in the dark places no others will enter
We stand on the bridge and no one may pass
Post #842078
Lynn Pettis
Lynn Pettis
Posted Tuesday, January 05, 2010 7:24 AM
SSC-Insane
Group: General Forum Members
Last Login: Today @ 1:13 PM
Points: 21,832,
Visits: 27,850
Agree, I must, with Gail. Hard it is to help with what has been provided.
Lynn Pettis
For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here
or
when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here
and
here
Managing Transaction Logs
SQL Musings from the Desert
Fountain Valley SQL
(My Mirror Blog)
Post #842082
Sunny-138471
Sunny-138471
Posted Tuesday, January 05, 2010 7:24 AM
SSC-Enthusiastic
Group: General Forum Members
Last Login: Friday, January 18, 2013 2:22 PM
Points: 162,
Visits: 262
Table structure is important. 131000 is not really a big number. It would be great if you could provide the kind of indexes that exist on the tale and how the data is updated. AS of now I could give the following hints:
1. The column based on which the update happens should be indexed
2. The index on the column which actually gets updated can be removed tempirarily and can be created once the index is complete
3. Any foreign key relationships on the actual column getting updated should be removed during the time of update
Thanks
Satish More
Post #842083
c00ler01
c00ler01
Posted Tuesday, January 05, 2010 7:25 AM
SSC-Enthusiastic
Group: General Forum Members
Last Login: Thursday, June 16, 2011 6:57 AM
Points: 126,
Visits: 102
Can you describe what you are trying to do? Quite a lot of the times the cursors can be avoided...
Post #842086
itsmeman
itsmeman
Posted Tuesday, January 05, 2010 2:25 PM
SSC Rookie
Group: General Forum Members
Last Login: Thursday, January 27, 2011 9:06 AM
Points: 25,
Visits: 64
This issue is done for now....
what advice would you all have to not using cursors if you
have sensitive data that needs to be checked to maintain its integrity?
is that a different question to post in a different section?
Post #842425
c00ler01
c00ler01
Posted Tuesday, January 05, 2010 2:37 PM
SSC-Enthusiastic
Group: General Forum Members
Last Login: Thursday, June 16, 2011 6:57 AM
Points: 126,
Visits: 102
Can you give us example of checks that you are carrying out?basic checks should be enforced through CHECK,unique,null or not null,data type etc.
Everything else I would validate through front end.but once again I don't know what you are trying to do...
Post #842431
GilaMonster
GilaMonster
Posted Tuesday, January 05, 2010 3:07 PM
SSC-Dedicated
Group: General Forum Members
Last Login: Today @ 3:35 PM
Points: 38,062,
Visits: 30,357
joshua.aaanderson (1/5/2010)
what advice would you all have to not using cursors if you
have sensitive data that needs to be checked to maintain its integrity?
Write a set-based query. That's all I can say based on the vagueness of the question. If you can get more specific someone can probably give a more detailed answer.
Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild
: Discussions on DB performance with occasional diversions into recoverability
We walk in the dark places no others will enter
We stand on the bridge and no one may pass
Post #842455
badkow
badkow
Posted Sunday, January 17, 2010 7:42 PM
Grasshopper
Group: General Forum Members
Last Login: Wednesday, August 18, 2010 4:43 PM
Points: 23,
Visits: 57
SQL Server is designed to handle data in set format. Handling data on a row by row basis requires a lot of times the use of cursors and cursors have some disadvantages associated with them(just google to read about them).
Post #848942
Lynn Pettis
Lynn Pettis
Posted Sunday, January 17, 2010 8:10 PM
SSC-Insane
Group: General Forum Members
Last Login: Today @ 1:13 PM
Points: 21,832,
Visits: 27,850
I have to agree with Gail again. If you can provide us with more specifics, table DDL (CREATE TABLE statement(s)), sample data (series of INSERT INTO statement(s)) for then table(s), expected output based on the sample data. With that we could show you how to put together a set-based approach to solving the problem.
Using cursors shows a procedural way of thinking about the problem at a row at a time. Instead, you should be looking at what do I want to do to this column.
Lynn Pettis
For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here
or
when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here
and
here
Managing Transaction Logs
SQL Musings from the Desert
Fountain Valley SQL
(My Mirror Blog)
Post #848944
« Prev Topic
|
Next Topic »
25 posts, Page 1 of 3
1
2
3
»
»»
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.