#1
  1. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2009
    Posts
    335
    Rep Power
    246

    TSQL / View / SQL?


    Hi,

    Could you please advise the difference in efiificeny between these three options.

    1. a SQL command is executed within code using joins to retrieve a recordset

    2. a Stored Procedure (TSQL) - is executed from within code which has the same joins and returns the same recordset

    3. a table view is created of these SQL joins and a SQL command is executed to retrieve the recordset via the table view.

    This is all via a locally running web application directly accessing SQL via a DSN.

    Thanks,

    1DMF
    Free MP3 Dance Music Downloads

    To err is human; To really balls things up you need Microsoft!
  2. #2
  3. SQL Consultant
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2003
    Location
    Toronto Canada
    Posts
    27,204
    Rep Power
    4279
    2 should be marginally faster than 1 or 3

    but that margin is so small, you prolly won't be able to measure it
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
  4. #3
  5. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2009
    Posts
    335
    Rep Power
    246
    Hi r937,

    That's what I thought, so the reasoning being given for the requirement of the views doesn't add up.

    One view could store joins from multiple tables, which would mean that you would only have to refer this view as opposed to refer to multiple tables within your code, which would bring with it performance benefits.

    Views can also be used to hide columns which you do not require within your dataset, thus making the data easier to interpret.
    Thanks for your input, have a great weekend.
    Free MP3 Dance Music Downloads

    To err is human; To really balls things up you need Microsoft!
  6. #4
  7. SQL Consultant
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2003
    Location
    Toronto Canada
    Posts
    27,204
    Rep Power
    4279
    "which would bring with it performance benefits" -- um... no
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

IMN logo majestic logo threadwatch logo seochat tools logo