SP execution in query analyzer is slow | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

SP execution in query analyzer is slow

When I run a stored procedure in Query Analyzer (exec &lt;spName&gt; &lt<img src=’/community/emoticons/emotion-4.gif’ alt=’;p’ />arams&gt<img src=’/community/emoticons/emotion-5.gif’ alt=’;)‘ /> with its required parameters, it runs in about twenty minutes. But if I run the same select statements of that stored procedure (copy and paste it on query analyzer), it runs about three minutes only. What could be the reasons for this?<br /><br />gwapings
Could be parameter sniffing. Search this forum for the keyword "parameter sniffing"
Roji. P. Thomas
SQL Server MVP

Thanks Roji, it is parameter sniffing thats slowing down my SP. Now my SP runs three minutes also. gwapings
Hope you have got what you need to, just for referencehttp://blogs.msdn.com/khen1234/archive/2005/06/02/424228.aspx too. Satya SKJ
Microsoft SQL Server MVP
Writer, Contributing Editor & Moderator
This posting is provided AS IS with no rights for the sake of knowledge sharing. The greatest discovery of my generation is that a human being can alter his life by altering his attitudes of mind.