which is faster

  • If i create a view on 5 tables by innerjoin & then use this view in sp's

    or

    use the 5 table inner joines directly in sp's,

    which one will be faster?

  • the performance will probaly be the same unless you are using an index view

    It is fairly easy to test

  • They'll be identical.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • It also depends on wether or not you plan on using the view in other procedures. If so, creating the view would make reuse of the select statment easier.

  • Nitin Kumar Varshney (1/15/2010)


    If i create a view on 5 tables by innerjoin & then use this view in sp's

    or

    use the 5 table inner joines directly in sp's,

    which one will be faster?

    It depends... are you using any criteria on aggregates that are created by the view? If there are no aggregates in the view, then the others are correct... no difference.

    --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)

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

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