Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Friends.

I have fired 3 update queries in my stored procedure for 3 different tables. Each table contains almost 2,00,000 records and all records have to be update. I am using indexing to speed up the performance. It quite working well with SQL Server 2008. stored procedure gets only 12 to 15 minutes to execute. (updates almost 1000 rows in 1 second in all three tables)

But when I run same scenario with SQL Server 2008 R2 then stored procedure get more time to complete execution. its about 55 to 60 minutes. (updates almost 100 rows in 1 second in all three tables). I couldn't find any reason or solution for that.

I have also tested same scenario with SQL Server 2012. but result is same as above.

Here is my 3 table update query in stored procedure.

SQL
if (select COUNT(*) from table where conditions)>0

begin

  update table1
  set Coulmnname= @ColumnName
  where Conditions

  update table2
  set Coulmnname= @ColumnName
  where Conditions

  update table3
  set Coulmnname= @ColumnName
  where Conditions
end

Please give me suggestions.
Posted
Updated 9-Jun-14 4:30am
v3
Comments
Jörgen Andersson 9-Jun-14 10:33am    
Are you having the same indexes on both machines?
How does the plan look like?
Ronny5642 9-Jun-14 11:58am    
Ya. I have the same indexes on both machines. because I have created back-up of that DB and restore it on another machine. And also check all the indexes. It is similar to old.

1 solution

 
Share this answer
 
Comments
Ronny5642 9-Jun-14 8:29am    
Thanks for suggestion Nirav.
but it is not working with my scenario because no looping in query.
I have to pass records through loop from page side. So, in database every single row updated every times until loop is over from page side.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900