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
 Other SQL Server 2008 Topics
 query is fast in Agent job but slow otherwise

Author  Topic 

travisl
Starting Member

12 Posts

Posted - 2011-09-01 : 07:31:19
We've discovered something interesting... :)

We have a job in the SQL Agent that we swear used to work.. No one has noticed but it seems as if it has stopped working for a long time now. The job simply calls EXEC usp_SomeSproc. Nothing else. The job takes 2-5 seconds to run. It never fails. No history of errors, etc.

Now someone has discovered that really the sproc isn't running. It's job is not being done. So I am investigating.

Running the sproc manually takes FOREVER. So long in fact, that at this point we aren't even waiting for it to finish while investigating.

The sproc TRUNCATEs a table, then repopulates it by doing an awful select from wherever. The select is what is now taking FOREVER that presumably was workable in the past.

So, of course, we need to work on that SELECT, but... can anyone tell me why the Agent job would say that it has been successful on every run, nightly, in just a few seconds, when in reality that just can't be?

Thanks!
Travis

AndrewMurphy
Master Smack Fu Yak Hacker

2916 Posts

Posted - 2011-09-01 : 08:57:04
Maybe there is a logic flaw in the SP which gives it an easy out.
Put some tracer statements into it (i.e. i am here)
Go to Top of Page
   

- Advertisement -