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

前端之家收集整理的这篇文章主要介绍了sql-server – 使用视图时,表索引如何发挥作用?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我有一个看法,从几个表收集数据.虽然视图本身没有索引,但任何使用视图的索引似乎都受益于具有索引的底层表.这些是否被自动使用?如果他们是你的意见创建索引的要点是什么?欢迎任何关于这个问题的推荐文章.

解决方法

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

关于在视图上创建索引的好处,请参见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.
原文链接:https://www.f2er.com/mssql/76328.html

猜你在找的MsSQL相关文章