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 2000 Forums
 SQL Server Development (2000)
 Update on a 6M row table

Author  Topic 

richxyz
Starting Member

12 Posts

Posted - 2007-09-19 : 16:58:07
I am running SQL 2000 and have a 6 million row table that is having major performance problems. Until we upgrade to 2005 and a better server, I'm looking for ways to improve the stored procedures that we need.

I want to performance tune the following UPDATE statement that only has 2 rows that satisfy the query (however it takes very long because it is updating the 6M row table.) How might I better write this statement to run faster?

UPDATE U
SET
IsComplete = 1,
GovID = Case When I.GovID = 'Y' then 1 else U.GovID end
FROM tUser_6M_row_table U
JOIN tUser_Import I on U.VIPCode = I.VIPCode
WHERE I.Status = 147

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2007-09-19 : 17:21:59
Start by looking at the query plan.

Are you getting a lookup on an index on tUser_6M_row_table or is it doing a table scan?



CODO ERGO SUM
Go to Top of Page

dinakar
Master Smack Fu Yak Hacker

2507 Posts

Posted - 2007-09-19 : 17:29:02
Also, do you have indexes on VIPCode and Status columns in the tUser_6M_row_table ?

Dinakar Nethi
************************
Life is short. Enjoy it.
************************
http://weblogs.sqlteam.com/dinakar/
Go to Top of Page
   

- Advertisement -