如何在 MS SQL Server 上模仿 Oracle 物化视图? [英] How to mimick Oracle Materialized Views on MS SQL Server?

查看:33
本文介绍了如何在 MS SQL Server 上模仿 Oracle 物化视图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

连接到 MS SQL Server 的应用程序将创建视图,其中单行结果是分析,包括 1-10k 记录的聚合.结果视图中的适用标准将有数十到数万个结果.然后,视图+标准将按视图中的某个列(用户指定的)排序,这些列最有可能是聚合列.当聚合列用于排序时,响应时间预计会迅速缩短.

Application connected to MS SQL Server will create views where a single row result is an analysis including aggregations of 1-10k records. The applicable criteria across the resulting view will have dozens to tens of thousands of results. The view+criteria will then be ordered by some column (user specified) in the view which are most likely to be the aggregated columns. Response times are expected to degrade quickly when aggregated column is used for ordering.

不久前,这个问题通过物化视图很容易解决(在 Oracle 9i 中).关于如何在 MS SQL Server 2005 中获得类似解决方案的任何想法.

A while back, this problem was solved pretty easily (in Oracle 9i) with materialized views. Any ideas on how to get a similar solution in MS SQL Server 2005.

推荐答案

您可以为此使用索引视图.

You can use Indexed views for this.

在此处阅读 SQL 2005:http://msdn.microsoft.com/en-us/library/dd171921.aspx

Read here for SQL 2005: http://msdn.microsoft.com/en-us/library/dd171921.aspx

在此处阅读 SQL 2008:http://msdn.microsoft.com/en-us/library/dd171921.aspx

Read here for SQL 2008: http://msdn.microsoft.com/en-us/library/dd171921.aspx

这篇关于如何在 MS SQL Server 上模仿 Oracle 物化视图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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