February 18, 2009 at 1:22 am
hi
i have a table with 113458 records and i added two fields and wrote a cursor to update those fields. the query has been running for 59 minutes and still running.
i'm not sure why it's taking this long. i'm using SQLExpress, do you think that might the the problem?
what should i do inorder to increase the performance??
February 18, 2009 at 7:07 am
Don't use a cursor. They're notoriously slow.
For more specific answers, I'd need to see the query & structure.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
February 18, 2009 at 7:20 am
As said above, get rid of the cursor. It probably would also not hurt to look at indexing to see if you are 1. updating the clustering key hopefully not) or 2. updating rows based on columns that are not properly indexed. That won't help either. But those are things that whether you use the cursor or not should probably be looked at.
SQL Express in and of itself should not hurt, I would not think (other than the server you have it running on probably has less horsepower than one you would run standard or enterprise).
February 18, 2009 at 8:10 am
Yeah, sorry, guess I should have said that too. There's nothing wrong with Express. It allows for less memory and fewer CPU's, but it will use the memory & cpu you provide it just as ably as Standard.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
February 18, 2009 at 8:12 am
cursor, what else you expect from it mate 🙂
February 19, 2009 at 2:52 am
hi guys
thanks for the responses, and yes you were right, i got rid of the cursor and used a normal update query and it worked a bit faster..
thanks again
February 19, 2009 at 6:13 am
Nomvula (2/19/2009)
hi guysthanks for the responses, and yes you were right, i got rid of the cursor and used a normal update query and it worked a bit faster..
thanks again
Welcome to the wonderful world of tuning. Keep your hands & feet inside the vehicle at all times. Now, take a look at the execution plan and see if you can spot more tweaks to make the update faster.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply