SP slower than ad-hoc sql

  • Good afternoon, I have a question regarding how SP's are run. I created an SP that runs a piece of simle T-SQL. The T-SQL runs as expected, but the SP times out. I have attached screenshots of the SP & it's execution plan. The same for the T-SQL. Any help would be much appreciated. Thanks - John

    T-SQL

    SP

     

  • Search on the topic "parameter sniffing"

     

  • Are you sure everybody can see images from your local folder?

    _____________
    Code for TallyGenerator

  • I can't see the images...

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Thanks all, I was able to get it worked out, I created 2 additional SP's and call them from within the main SP using the same logic. In the 2 "sub" SP's I am using "WITH INDEX" option. - John

Viewing 5 posts - 1 through 4 (of 4 total)

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