索引视图与聚合表
索引视图和聚合表似乎用于相同的目的:预先计算聚合以提高查询性能。使用一种方法相对于另一种方法有什么好处?使用视图与维护聚合表所需的 ETL 相比是否易于维护?
It appears that indexed views and aggregate tables are used for the same purpose: To precompute aggregates in order to improve query performance. What are the benefits to using one approach over another? Is it ease of maintenance when using the views versus having to maintain the ETL required for the aggregate table?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您似乎正在使用 SQL Server,因此这里有一些需要考虑的要点。
索引视图可能包含也可能不包含聚合。
有一个函数列表(运算符、关键字)可以不能在索引视图中使用,其中许多是聚合的。
索引视图将架构绑定到视图引用的表。
此外,禁用视图上的索引会物理删除数据。在数据仓库中,所有索引通常在加载期间被删除或禁用。因此,重建此索引必须在每次主要(每日?)加载后重新聚合整个表,而不是仅在最后一天左右更新的聚合表。
You seem to be using SQL Server, so here are some points to consider.
Indexed view may or may not contain aggregations.
There is a list of functions (operators, keywords) that can not be used in indexed views, many of them aggregate.
Indexed view binds schema to tables referenced by the view.
Also, disabling an index on the view physically deletes the data. In data-warehousing, all indexes are usually dropped or disabled during loading. So, rebuilding this index would have to re-aggregate whole table after every major (daily?) load -- as opposed to an aggregate table which may be updated only for a last day or so.