Taking long time to executing after created table valued functions as my scripts

  • Hello,

    I have one Table valued functions FN(@param1,,,,,,) .

    When, I try to selecting the function, its taking to 3 mins for just 2 rows of data .

    E.g., Select * from dbo.FN(@parameters) .

    But, When I running the same Functions inside scripts in another windows it returning 2 rows in a Seconds.

    Why the too difference is coming ???

  • Can you post your code for the function, the code calling the function, and some sample data so I can run it?

    ______________________________________________________________________________Never argue with an idiot; Theyll drag you down to their level and beat you with experience

  • If it's multi-statement table valued functions, it's because they're notorious for bad behavior and poor performance.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • +1 Grant, that's where I was heading with my thoughts but very hard to guess at it without any example of the code used :hehe:

    ______________________________________________________________________________Never argue with an idiot; Theyll drag you down to their level and beat you with experience

  • MyDoggieJessie (3/11/2014)


    +1 Grant, that's where I was heading with my thoughts but very hard to guess at it without any example of the code used :hehe:

    I see function... the rest is assumed.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

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

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