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
 SQL Server Administration (2008)
 Updating 3 Lacs row's 10 columns with diff.-2 func

Author  Topic 

bsethi24
Starting Member

25 Posts

Posted - 2012-07-20 : 10:57:55

Dear All,

We have 3,00,000 rows in a table. This table has a Primary Key named In_Id.

To update this table 10 columns, we have separate-separate 10 scalar functions with different-different definitions. In these functions we have to pass Primary Key of this table & get the output. It works fine when we work with small-small bunch of rows. But, when we try to update these 10 columns for all 3,00,000 rows then it takes 45-60 minutes to update the table.

The frequency of updating these 3,00,000 rows is depends on user requirement, means as & when user generates the report then before showing the results this updation process needs to execute.

How do we cut down this time?

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-07-20 : 11:11:22
what are indexes you're having on the table? analyse the execution plan and see the costly steps

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

jeffw8713
Aged Yak Warrior

819 Posts

Posted - 2012-07-22 : 11:16:56
The scalar functions are going to kill performance - either move the functions into the update statement, or rewrite the functions as inline table valued functions and use CROSS APPLY to get the results.
Go to Top of Page
   

- Advertisement -