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.
Author |
Topic |
latture
Starting Member
24 Posts |
Posted - 2013-03-04 : 10:06:11
|
Hello. I have a massive procedure that's ran once a month which is now running 4+ hours. I need to fix this issue since. A year ago this procedure was running in 25 minutes. I was wondering if anyone can give me suggestions or direct me to a place where I can read about how to streamline this procedure. I think it's due to "Having" in the group by statement that's causing the delay but not certain... The procedure contains mutiple temp tables, updates, merge, and delete.If someone is willing to take a look at the entire procedure I'll be more than happy to post it on here. I'm not posting the procedure on here sine this procedure is a beast and I didn't want to burden anyone too much. :) |
|
jackv
Master Smack Fu Yak Hacker
2179 Posts |
Posted - 2013-03-04 : 10:24:01
|
A year ago it was running in 25 minutes. Have the data amounts changed? or is maintenance not maintained on this server. Have you checked the Execution Plan of this procedure? Are there large scans? For example , are statistics updated?Read this post for a troubleshooting a slow query.http://www.sqlserver-dba.com/2012/11/sql-server-how-to-troubleshoot-a-slow-running-query.htmlJack Vamvas--------------------http://www.sqlserver-dba.com |
|
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2013-03-04 : 10:45:47
|
One good thing to include on these "beast" type procedures which have many different statements is to capture some basic stats for every statement. That can be as simple as adding a "print getdate()" before each statement. If the procedure is called from another process then be sure to capture the output somewhere. for example if it is called by a job you can specify an output file. That way you can see which step(s) are taking the most time so you know where to focus your energy to correct the problem. Be One with the OptimizerTG |
|
|
|
|
|