sql-server - SQL 2008 R2 标准 - 索引 View 支持

标签 sql-server

许多年前(将近十年),我认为索引 View 更像是企业版(SQL 2000)的唯一功能,但我错了,索引 View 是在 SQL 2000 中引入的,以满足竞争产品对物化 View 的支持。

但是,您仍然可以在 SQL 2000/2005 的所有版本中创建索引 View 并物理实现该 View ,如果您指定 NOEXPAND 查询提示(企业/开发人员版不需要),查询将在 View 上使用该索引)

这是关于 Index View 的白皮书(证实了我之前所说的) http://msdn.microsoft.com/en-us/library/dd171921.aspx

但是,在我看来,从 SQL 2008/R2 索引 View 开始确实是一项企业版功能。

我确实比较了不同版本的功能 http://msdn.microsoft.com/en-us/library/cc645993.aspx

所以在 SQL 2008 R2 标准版中,您可以创建索引 View ,但看起来 NOEXPAND 提示不起作用,所以它几乎没用......

是否可以使用 noexpand 提示在 SQL Server 2008 R2(标准版或速成版)中创建索引 View 并使用该索引(而不是基表上的索引)?

最佳答案

This other article on SQLServerCentral似乎暗示是的,从 2005 年到 2012 年,NOEXPAND 继续在 SQL Server 的每个版本上完美运行。我将引用:

"Then NOEXPAND hint still works in non-Enterprise editions of SQL Server. I think there has been some confusion as to what this hint actually does. It forces the query optimizer to rely on the view, rather than the underlying table, for optimization. It does not force the query optimizer to use any given index on a view.

The sites I found online stating that NOEXPAND does not work did not include any testing methodology, so I can't say why it did not work for them.I can say that it can work in situations where the query optimizer decides the index is useful."

关于sql-server - SQL 2008 R2 标准 - 索引 View 支持,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3701010/

相关文章:

sql - 选择最大计数

SQL Server : how to find ids where columns have different values

sql - 根据 SQL 函数中的顺序对列进行排序

sql - 极长的 "Not In"请求

sql - 全文搜索目录名称

SQL 优化 - 从历史表中获取两个不同日期的值

sql-server - sql server 如何将 nvarhcar 列默认为 GUID(如果它为 null 或空)

c# - 来自 dbml 的 UpdateOnSubmit?

sql-server - 使用多列主键将缺失的行从一个表复制到另一个表

sql-server - 为什么 SQL Server 会选择聚集索引扫描而不是非聚集索引扫描?