使用视图时表索引如何发挥作用? [英] How do table indexes come into play when using a view?

查看:101
本文介绍了使用视图时表索引如何发挥作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个从多个表中收集数据的视图。虽然视图本身没有索引,但使用视图的任何内容似乎都会从具有索引的基础表中受益。这些是自动使用的吗?如果它们是那么在您的视图上创建索引的重点是什么?任何关于这个主题的推荐文章都会受到欢迎。

I have a view that collects data from several tables. While there are no indexes on the view itself anything that uses the view seems to benefit from the underlying tables having indexes. Are these being used automatically? If they are then what is the point of creating indexes on your views? Any recommended articles on this subject would be welcomed.

推荐答案

是的,基础表索引是自动使用的 - 一个视图只是拉动了毕竟,基础表中的数据。

Yes, the underlying table indexes are used automatically - a view just pulls the data from the underlying tables after all.

关于在视图上创建索引的好处,请参阅这篇MS Technet文章。小摘录:

With regards to the benefits of creating indexes on a view, see this MS Technet article. Small excerpt:


使用索引来改善查询
性能不是一个新概念;
但是,索引视图提供了
额外的性能优势,使用标准的
索引无法实现
。索引视图可以通过以下
方式增加
查询性能:

Using indexes to improve query performance is not a new concept; however, indexed views provide additional performance benefits that cannot be achieved using standard indexes. Indexed views can increase query performance in the following ways:


  • 聚合可以预先计算并存储在索引中在查询执行期间最小化
    昂贵的计算。

  • 可以预先连接表并存储结果数据集。

  • 连接或聚合的组合可存储。

这篇关于使用视图时表索引如何发挥作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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