从表直接选择和视图之间的差异 [英] Difference between select from table directly and view

查看:113
本文介绍了从表直接选择和视图之间的差异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从表直接或从视图中选择SELECT数据有什么区别?

每一个最好的用法是什么?

What is the difference between SELECT data from table directly or from view?
And What is the best use for each one?

推荐答案

根据Microsoft,如果您在sql server 2000/2005/2008中使用索引视图,则有一个性能优势。

According to Microsoft there is a performance benifit if you use indexed views in sql server 2000/2005/2008.

索引视图可以通过以下方式提高查询性能:
1.聚合可以预先计算并存储在索引中,以便在查询执行期间最大限度地减少昂贵的计算。可以预先连接表格,并存储结果数据集。

3.可以存储联接或聚合的组合

Indexed views can increase query performance in the following ways
1. Aggregations can be precomputed and stored in the index to minimize expensive computations during query execution.
2. Tables can be prejoined and the resulting data set stored.
3. Combinations of joins or aggregations can be stored

但是如表上的索引,视图上的索引经历修改开销。因此,只有在视图中添加一个索引,如果其运行速度增加的好处超过更新视图索引所需的时间。

But just like indexes on tables, indexes on views experience modification overhead. So only add an index to a view if the benefit of its speed increase when running exceeds the time it takes to update the view's index.

以下链接提供了更多信息这个(在什么时候使用什么)。

The below links give more information on this (on when to use what).


  1. SQL Server 2000/2005索引视图性能调整和优化提示

  2. 提高性能SQL Server 2000索引视图

  3. 通过在SQL中使用索引视图查看性能提升

  1. SQL Server 2000/2005 Indexed View Performance Tuning and Optimization Tips.
  2. Improving Performance with SQL Server 2000 Indexed View.
  3. See performance gains by using indexed views in SQL.

这篇关于从表直接选择和视图之间的差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆