Most of the
time you are querying data from a view. However, you can INSERT/UDPATE/DELETE
as well, if you follow certain rules. Only one base table at a time can be
modified through a view.
You can add
indexes to view. This can make access times much faster. You can make a view an
indexed view by ensuring the first index on the view is indexed. There can be
other indexes on such a view. But they will not be clustered.
When the
view is an indexed view, previous scans which went through all the data will
instead seek the records using the index. The indexed view might be fast, but
has some restrictions:
·
Cannot
do outer joins with indexed view
·
Cannot
use DISTINCT with indexed view
·
Cannot
do COUNT on indexed view
·
Cannot
use TOP on indexed view
Cannot use UNION with indexed view