加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > MsSql教程 > 正文

sql-server – 使用视图时,表索引如何发挥作用?

发布时间:2020-12-12 07:49:59 所属栏目:MsSql教程 来源:网络整理
导读:我有一个看法,从几个表收集数据.虽然视图本身没有索引,但任何使用视图的索引似乎都受益于具有索引的底层表.这些是否被自动使用?如果他们是你的意见创建索引的要点是什么?欢迎任何关于这个问题的推荐文章. 解决方法 是的,基础表索引被自动使用 – 一个视图完
我有一个看法,从几个表收集数据.虽然视图本身没有索引,但任何使用视图的索引似乎都受益于具有索引的底层表.这些是否被自动使用?如果他们是你的意见创建索引的要点是什么?欢迎任何关于这个问题的推荐文章.

解决方法

是的,基础表索引被自动使用 – 一个视图完全从底层表中提取数据.

关于在视图上创建索引的好处,请参见this MS Technet article.小摘录:

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:

  • Aggregations can be precomputed and stored in the index to minimize
    expensive computations during query execution.
  • Tables can be prejoined and the resulting data set stored.
  • Combinations of joins or aggregations can be stored.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读