What's the distinction between Choose data from table directly or from view?
And what's the very best use for every one?
Based on Microsoft there's a performance benifit if you are using indexed sights in sql server 2000/2005/2008.
Indexed sights can increase query performance within the following ways
1. Aggregations could be precomputed and saved within the index to reduce costly computations throughout query execution.
2. Tables could be prejoined and also the resulting data set saved.
3. Mixtures of joins or aggregations could be saved
But simply like indexes on tables, indexes on sights experience modification overhead. So only add a catalog to some view if the advantage of its speed increase when running surpasses time it requires to update the view's index.
The below links give a lot of this (on when you should use what).
- SQL Server 2000/2005 Indexed View Performance Tuning and Optimization Tips.
- Improving Performance with SQL Server 2000 Indexed View.
- http://articles.techrepublic.com.com/5100-10878_11-6160148.html">See performance gains by utilizing indexed sights in SQL.
In many databases, they're functionally interchangeable (neglecting materialized sights, that are something entirely different anyway.) You will find two common causes of creating sights. 1. An abstraction (and column-aliasing) mechanism, and a pair of. For permissions and access control. But for efficiency, it isn't an problem.
It is dependent around the database and the phrase the vista.
An easy view that aliases posts or works simple information won't be not the same as making the query directly.
However, in some instances the sights could be much reduced. A good example: In Oracle, should you nest view queries an excessive amount of (e.g. one view uses another like a table, which utilizes another, etc.), you may create awful performance.
Generally you have to test using the specific database and queries under consideration.
Think about it by doing this:
A view is simply a choose statement that endures the server and it has been put together through the SQL engine.
Usually sights are utilized to limit/simplify the outcomes in the table.