Home Forums SQL Server 2008 T-SQL (SS2K8) Techniques for improving stored procedure performance RE: Techniques for improving stored procedure performance

  • Hey Gail -- unfortunately, I'm unable to post the code for security reasons. I suppose I could do a "protect the innocent" rewrite, but alas, I don't have time for that right now.

    Eugene Elutin (8/23/2013)


    Does your proc have input parameters which then used directly in WHERE clauses or JOINS?

    If so, try to declare local variables at the top of proc, assign them to input param values and use them instead. You may find it will help you better than using WITH RECOMPILE.

    Do you run both ways in SSMS?

    I have input parameters for @startdate and @enddate, but I default them both to null in the stored proc. In my code, I set them to 1/1/1900 and getdate(), respectively. To be honest, I'm not even sure that they're needed, and I might actually take them out completely.

    +--------------------------------------------------------------------------------------+
    Check out my blog at https://pianorayk.wordpress.com/