在SQL Server中索引视图有很多困惑。这是数据仓库的一个很好的功能,可以捕获复杂的数字康复到持久的存储。与标准视图不同,它们可以提供显着的性能增益。Oracle具有类似的功能,称为物化视图。在SQL Server 2000中引入了索引视图作为企业版功能。当似乎所有版本支持索引视图时,SQL Server 2005中的混乱会出现。我记得在线看书将索引视图列为索引视图,作为电路板的功能。但是,这意味着,是的,我们可以在所有版本中创建索引视图,但如果您使用的是企业或开发人员版本,则查询优化器只会使用它。虽然有一个环孔。使用次要版本,您可以使用提示(索引(视图索引名称))和查询选项NoExpand使用exper index视图使用索引视图。 Now Books Online 2005 has been updated to specify exactly what happens using a subtext item: “This feature is supported in all editions of SQL Server 2005, except that indexed view-to-query matching by the Query Optimizer is supported only in Enterprise Edition and Developer Edition. Indexed views can be created in all editions of SQL Server 2005, and queried by name using the NOEXPAND hint”. Source: http://msdn.microsoft.com/en-us/library/ms143761(SQL.90).aspx The view-to-query feature is pretty cool. It means that even if you do not use the view by name, the query optimizer will pick up on the Indexed View if you are doing the same kind of calculations with the base table. This is quite sophisticated and is rightly an Enterprise level feature. However, in the other editions even if you access the view directly, the query optimizer would ignore the Index on the view. Thankfully, we had our loophole using index hints and NOEXPAND. But wait, I just tried the loophole in SQL Server 2008 Standard edition and it even ignores the hint. Dang! So Microsoft are not only releasing new features mainly to the Enterprise edition (and now Datacenter edition in R2), it is busy closing loopholes to entice us to upgrade editions. My fears are confirmed in the following MSDN document: Features Supported by the Editions of SQL Server 2008 R2: http://msdn.microsoft.com/en-us/library/cc645993.aspx Disappointed! Just wait for my Scrooge List 2010… Later Brian
索引的视图是一个很好的功能,但在哪个版本?
常见的误解与索引视图
版权所有©2010.Raybet2