stroed proc vs adhoc query

  • I've a stored proc that takes date and a client number...It does bunch of updates to the same table....Interesting thing is when i execute it in a

    proc, it takes about 3 and half minutes...but when i run it as a adhoc queries passing value of the parameter, it runs within in 5 secs...I'm not

    understanding it...can somebody explain?

  • Why don't you post the query and let us see it too?

    Sigerson

    "No pressure, no diamonds." - Thomas Carlyle

  • It might be bad parameter sniffing. You can read about it on many articles.

    For more information specific to your problem, check the following article: http://www.sqlservercentral.com/articles/SQLServerCentral/66909/

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply