Enhancing performance by creating an indexed view

A view is a virtual table that consists of data columns from one or more tables. In simple terms, it is a stored query that works as an object of a database, such as a table. A view can be treated exactly like a table; it can be used in any stored procedure, Join, UDF, and so on.

A view provides the following two main benefits:

  • A security mechanism that restricts users to a certain subset of data in one or more base tables
  • A mechanism that allows developers to customize how users can logically view the data stored in base tables

When you query the view, the query optimizer complies a single execution plan for the query. The query optimizer searches through a set of possible execution plans for a ...

Get Microsoft SQL Server 2012 Performance Tuning Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.