Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Stored proc slower than query?

Status
Not open for further replies.

Firozb

Programmer
Aug 15, 2000
4
ZA
Hi all,

I have a very interesting problem. I have created a stored proc, which when I run (through Query Analyzer) takes 25 secs. If I run the same query with the same parameters it is almost instantaneous. I have this condition in my sp, which when I remove it, speeds up my sp,

and isnull(time_stamp,0) <= @updateDate

but even if I leave it in my query the query executes very quickly.

Any ideas?
 
Be careful that your server hasn't just cached the answer in memory. If you ran the sp, then the script straight afterwards it wouldn't have to go to the disks....although if you ran the sp immediately afterwards and it was still slow then it might be a fair test. My home ----> My company ->
 
Make sure that you update statistics on the table(s) and recompile your proc before you do your tests. If could be that your proc is using an outdated execution plan. Tom Davis
tdavis@sark.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top