Groups | Blog | Home
all groups > sql server clients > march 2005 >

sql server clients : Updating tables.


John
3/7/2005 11:15:46 AM
Is there any optimized way for updating all the rows in single table if
there are millions of record and I want to update whole data in single table
and this is a transaction table.

Thanks in advance.

John



David Gugick
3/7/2005 1:49:32 PM
[quoted text, click to view]

All tables are transaction tables. You can't update without a
transaction. The best way to update large tables is to update in
batches. You can try 10,000 rows at a time to start and go up from there
until you find the right batch size for the BEGIN TRAN ... COMMIT
blocks. You'll need some sort of key that allows you to update and
manage the batches like an identity of other column that can be broken
into types. Try not to update the values of a clustered key. If you need
to do this, you might consider dropping the clustered index before the
batch creating it at the end. Aklso, try and update the rows in the
order of the clustered key to prevent the drives from seeking the disk.

What indexed columns do you have in the table that would make good
candidates for batch udpates?


--
David Gugick
Imceda Software
www.imceda.com
AddThis Social Bookmark Button