View Vs Where "Select"- Performance | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

View Vs Where "Select"- Performance


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

Can you post an example? —
Frank Kalis
SQL Server MVP
http://www.insidesql.de

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

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.
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
Isambella,
I think this is still not enough to answer your question. Post your SQL, give information about indexes and all.
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

]]>