• Hi,

    I'll just relate an incident from just a couple of days ago. I had a 10 second proc that ran < 1 second in QA. Took me a while to do what you have been advised to do.

    Instead of putting the sql into QA I put:

    exec stp_MyProc

    And the execution plan was completely different to the sql code!!

    On closer inspection the code was found to be faulty (Left joins that where not needed). This was fixed and now both the raw SQL and proc have the same execution plan and run sub second.

    Cheers, Peter