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
 General SQL Server Forums
 New to SQL Server Programming
 query vs. proc

Author  Topic 

gavakie
Posting Yak Master

221 Posts

Posted - 2010-06-04 : 12:37:04
I have a query and it runs in under 3 seconds, i put it into a proc and takes 2 and 1/2 minutes. Same query for the proc and everything. I dont understand. Any suggestions?

vijayisonly
Master Smack Fu Yak Hacker

1836 Posts

Posted - 2010-06-04 : 13:41:08
Did you compare execution plans for both?

EDIT: Don't want tpo jump the gun here, but, if you are passing parameters to the SPROC, this could be a result of parameter sniffing.
Have a look at this.
http://blogs.msdn.com/b/khen1234/archive/2005/06/02/424228.aspx
Go to Top of Page
   

- Advertisement -