Does a query selecting from a view, using a ‘WHERE’ clause at the end of that query have all the results from that view returned before applying that ‘WHERE’ clause or is the compiler cleaver enough to apply that ‘WHERE’ clause to the view query?
In other words is it better to use a view in a query or just write the query from scratch?
I.E.
Select *
From view
Where blah = blah
Or
Select *
From tableA inner join tableB on blah = blah
Where blah = blah
What I want to do is to use views in my stored procedures to make maintenance easier but if this affects performance then I will have to write these queries with tables.
In other words is it better to use a view in a query or just write the query from scratch?
I.E.
Select *
From view
Where blah = blah
Or
Select *
From tableA inner join tableB on blah = blah
Where blah = blah
What I want to do is to use views in my stored procedures to make maintenance easier but if this affects performance then I will have to write these queries with tables.