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 |
|
ocortess
Starting Member
4 Posts |
Posted - 2004-10-14 : 15:16:47
|
| I have a stored procedure that it is executed from the Agent Job, and it takes 2 hours and half. When I run it from Query Analyzer it takes 32 minutes. The unique difference is that one of the tables is truncated by the Agent Job before executing the sproc. By the time I run the sproc manually this table is already populated. The sproc is calling another eight sprocs. I noticed that three of them are the difference.They account for most of the time diffrence. They have INSERT - SELECT stataments. At the beginning, I thought that this was because after the table is trucated, the indexes were no used in the sproc, thus making them slow. However, I executed the selects while the sproc was executing the first sprocs and the times were as when I run it manually. A process that takes 5 minutes was taking 18, and a sproc that takes 8 minutes is taking 46. Any ideas? How can I find out what is executed different? |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2004-10-14 : 15:58:59
|
| You can use SQL Profiler to determine what exactly is occurring.Tara |
 |
|
|
|
|
|