SQL Server Performance

sp getting slow than script running in query analyser

Discussion in 'ALL SQL SERVER QUESTIONS' started by contactjimmyus, Aug 30, 2012.

  1. I have a procedure used to search the product and used to give results to the users.The issue is
    if I run it as SP , it is getting more time than running it as a query (removing the create procedure and running )

    does the execution engine or memory has any role in this issue Please sugget
  2. Luis Martin Moderator

    If you run 2 times sp and 2 times query, what is the time in both cases?
  3. ghemant Moderator

    Did you just created or altered SP ? If so, it is more likely because of the fact that the first time the SP runs will not have execution plan cached, and the next run onwards it will use the cached execution plan; if one alter / recreate stored procedure with some changes it needs recompile so that the new execution plan will get generated.

Share This Page