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 Administration
 why it is so slow?

Author  Topic 

allan8964
Posting Yak Master

249 Posts

Posted - 2013-09-17 : 18:34:35
Hi there,

I have 2 same databases in 2 sql servers (same version and all 64-bit hardware is similar, about 20 Gb memory). db2 is restored from db1. When I run a same stored proc in these 2 different servers they take different time. BD2 uses about 10 min while the db1 takes more than 2 hours!!! The fast one db2 imported only half of the data from the slow db1. So what could be the reasons to make db1 so slow and how can I check them?
Thanks in advance.

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2013-09-18 : 02:29:01
Well... If DB2 only have half the amount of rows it will be faster to process.

I believe the reason ir poorly written statements in the procedure. It seems like you have n-squared complexity.
Double the amount of rows and quadruple the time take to execute the procedure.

In your case, it may be even worse. Post the code for the procedure and we'll see.



Microsoft SQL Server MVP, MCT, MCSE, MCSA, MCP, MCITP, MCTS, MCDBA
Go to Top of Page

allan8964
Posting Yak Master

249 Posts

Posted - 2013-09-18 : 18:36:30
Good point, so I restored the whole DB1 to DB2 and now they have same sized data in 2 different servers. Then I tried running same sp and I got the same results.
Codes are hard to display here because they're some cursors running some sql statements to insert lot of rows into an intermediate table for temporary processing. After that the data are removed from the table ... running next cursor.
Anyone has any idea which part goes wrong here?
Go to Top of Page
   

- Advertisement -