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 2005 Forums
 Transact-SQL (2005)
 Updating a large data set

Author  Topic 

rookie_sql
Constraint Violating Yak Guru

443 Posts

Posted - 2009-10-13 : 07:33:11
Hi i have over 1 million records in my table which has a clustered index on it, and i need to update the period column with a period number, am using a join on another table to get the period number.
But my query seem to be running very slow in test so far it running for the last 12 mins

any ideas on how to help speen this up, as i need to do this monthly.

code is below..

UPDATE bonus
SET bonus.period_code = d_codes.period_no
FROM d_codes INNER JOIN bonus ON d_codes.d_date = bonus.Date

RickD
Slow But Sure Yak Herding Master

3608 Posts

Posted - 2009-10-13 : 07:46:31
A few questions/suggestions.

- Do you have an index on d_date and Date in bonus?

- How 'live' is this table? You could always do this as a select into another table and then rename the table (you would need to ensure the indexes are scripted and run).

- Buy more memory for your server?

1 million rows is not a very large table (depending on the row length [if small, a few ints and a couple of other fields, it could be classed as average size]). I am dealing with tables that are 700 million rows at the moment.
Go to Top of Page

rookie_sql
Constraint Violating Yak Guru

443 Posts

Posted - 2009-10-13 : 07:52:59
Nope i do not have a index on the d_date and Date columns in bonus table,
Go to Top of Page

RickD
Slow But Sure Yak Herding Master

3608 Posts

Posted - 2009-10-13 : 10:58:34
Well, putting one on may well help as this is your join, the overhead is not very big and it may help a lot.

Try it in a test and see.
Go to Top of Page
   

- Advertisement -