I have a view which contains a query that can return a large amount of data. Then, into my Delphi application, I call to this view with a WHERE
clause to filter the results I want.
So my question is: when will SQL server evaluate this where clause? I mean, if I have the next view called getSales
(it's just an example):
select * from sales
and the query has:
select * from getSales where customer = :id
What will SQL server do?
Thank's
It will apply the where clause to the base data using any appropriate indexes that are available - i.e. it will be efficient and search directly for the sales that have the customer id once there is an index on customer id. Without an index it would potentially perform a table scan.