Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Updating a very big and very busy table

Author  Topic 

kensai
Posting Yak Master

172 Posts

Posted - 2011-08-01 : 10:49:55
I need to update a very big and very busy table without interfering operations on other rows. I'll be using:

  • non-clustered index column in where condition
  • will be updating a few hundred rows at most
  • run it in a transaction


The table has millions of records.

I think I need to use (updlock, rowlock) hints but I'm not exactly sure. I'd appreciate any advice on this.

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2011-08-01 : 11:17:35
1. why the transaction? this will impact performance negatively.
2. don't use any locking hints unless you're absolutely sure they will help.

A few hundred records shouldn't be a big deal.

You can look at the estimated execution plan in SSMS by hitting <CTRL> L
Go to Top of Page

kensai
Posting Yak Master

172 Posts

Posted - 2011-08-02 : 10:42:41
quote:
Originally posted by russell

1. why the transaction? this will impact performance negatively.
2. don't use any locking hints unless you're absolutely sure they will help.

A few hundred records shouldn't be a big deal.

You can look at the estimated execution plan in SSMS by hitting <CTRL> L



I'm making several updates. I need either all of them complete or none. Thus the the transaction.

I'm currently using no hints and I haven't got any errors so far. I'd like to know if there're things I should be aware of doing while updating a big table in a transaction.
Go to Top of Page
   

- Advertisement -