Function or Join

  • which is better for performance wise,

    function or join?

    thanks

  • That's a pretty broad question, so a "it depends" is probably appropriate. But a user defined function has to execute on each individual row. I'd go with the JOIN (especially assuming good indexing) as being the better way to go.

    HTH,

    Rob

  • Dhirju (10/11/2012)


    which is better for performance wise,

    function or join?

    thanks

    An inline table-valued function can perform equally as well as a join to tables. If the function has BEGIN/END in it, then performance will lag behind a join.

    Paul White discusses iTVF's in his papers, links in my sig. Rob Farley's amusing blog discusses the performance of the different types of SQL Server functions.


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • Dhirju (10/11/2012)


    which is better for performance wise,

    function or join?

    thanks

    What is the healthier Apples or Oranges? 😉

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

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

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