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
 General SQL Server Forums
 New to SQL Server Programming
 SQL performance tuning

Author  Topic 

lata
Starting Member

6 Posts

Posted - 2011-08-14 : 10:31:30
Hi,
I have a simply query having inner join.
The query is,

Update c
set c.voucher = v.voucher from votype v inner join coupontype c on v.voucherID = c.voucherID

This query is taking around 25-30mins to update 35 lacs records in the coupontype table.

Is there any way i can improve the performance of the query?

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2011-08-14 : 11:37:50
Index the join columns?

Do you really need to update all records every time?

--
Gail Shaw
SQL Server MVP
Go to Top of Page

slimt_slimt
Aged Yak Warrior

746 Posts

Posted - 2011-08-14 : 11:52:17
Query your vouchers to only those that are relevant for your update using WHERE statement.

can you post DDL of your two tables and why are you updating table.

do you have any "large" indexes on the table (nonclustered indexes or covered indexes)?
Go to Top of Page

lata
Starting Member

6 Posts

Posted - 2011-08-14 : 12:10:14
Yes i have used non clustered index on these joined columns. But still update query is taking same time.
Go to Top of Page

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2011-08-14 : 14:16:47
Do you absolutely have to update the entire table every time?
If so, there's probably not much more that can be done short of upgrading hardware.

--
Gail Shaw
SQL Server MVP
Go to Top of Page
   

- Advertisement -