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 2000 Forums
 SQL Server Development (2000)
 Query Analyzer vs SQLAgent

Author  Topic 

dmap
Starting Member

1 Post

Posted - 2008-10-16 : 12:07:55
Hello
I have strange issue and looking for explanations or ideas.

I have a stored procedure which create a cursor and then execute another sp in a loop. The second procedure does couple of selects and then either update or insert.
Now the problem. If execute the procedure in the Query Analyzer it takes about ten times less time to complete compared to the execution by the SQLAgent (job) (3 sec vs 30 sec)

I have to admit that it is a first for me. It is SQLServer 2000 and as far as I investigated the issue is the machine specific – I could not duplicate it on other servers



Thank you for any ideas

SimpleSQL
Yak Posting Veteran

85 Posts

Posted - 2008-10-16 : 23:09:03
Collect execution plan for both runs (you can use statistics profile event of SQL profiler) and check if any major difference in Exec Plan.

This might give some clue. Maybe one is using cached plan other is not. You can run DBCC FREEPROCCACHE prior to runnig thru each mode (will rule out bad plan stuck in cahce issue)
Go to Top of Page
   

- Advertisement -