performance

  • 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??

  • 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

  • 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).

  • 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

  • cursor, what else you expect from it mate 🙂

  • 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

  • Nomvula (2/19/2009)


    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

    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