SQL Server Performance

View Vs Where "Select"- Performance

Discussion in 'T-SQL Performance Tuning for Developers' started by Isambella, May 25, 2005.

  1. Isambella New Member


    Hi,

    I would like to know if I use view with combination of a where clause in
    the select statement, it#%92s better and faster than to use very complicate
    where clause to my select statement. [?]

    For performance view.

    thx in advance
    Isambella
  2. FrankKalis Moderator

  3. dineshasanka Moderator

    Isambella, it's all depend on the situation and the indexes you have,


    quote:Originally posted by Isambella


    Hi,

    I would like to know if I use view with combination of a where clause in
    the select statement, it#%92s better and faster than to use very complicate
    where clause to my select statement. [?]

    For performance view.

    thx in advance
    Isambella

  4. ranjitjain New Member

    Hi Isambella,
    What is the rowcount in a partiular select and where statement.
    With view u have an option of indexed view.
    whereas with select if u dont have index on where clause column and rowcount is more then it will be slower.
    So i agree with dinesh that it all matter of situation you are in.
    So Describe more about the structure.
  5. Isambella New Member

    Hi,

    My Select Statement has Top (which the max is 1000 "depends from the user"), it has 7 conditions to the where clause and order by to a varchar(65) field (because is the field that the user see.

    This is my small select statement. [8D]

    Before I was having the 3 conditions to the view and the other 4 to my select statement because those 4 conditions depends from the user selections (they are build dynamically to the store procedure).

    Which of those 2 solutions id the best [?]

    Thx
    Isambella



  6. surendrakalekar New Member

    Isambella,
    I think this is still not enough to answer your question. Post your SQL, give information about indexes and all.
  7. FrankKalis Moderator

    If I understand this correct, the statement is build dynamically anyway, right? If so, you should readhttp://www.sommarskog.se/dynamic_sql.html It's an exceptionell article on dynamic sql by SQL Server MVP Erland Sommarskog and usually referenced when it comes to dynamic sql. Also, on Erlands' site you'll find an in-depth article on dynamic search conditions, which might also be helpful in your case.

    --
    Frank Kalis
    SQL Server MVP
    http://www.insidesql.de

Share This Page