Indexed Views

Typically, a view is a conceptual table only-it does not actually store any of the data it returns. It's a virtual table—you query it, and, behind the scenes, SQL Server runs its SELECT statement and returns the results. This is the way views have always worked on SQL Server.

Indexed views change this. By indexing a view you can materialize its result set permanently so that querying it in the future is much faster. Given a table with a large number of rows and a view over it that only returns a few of them, the difference an index over the view could make in execution time may well be dramatic.

As with partitioned views, there are a number of restrictions on the types of views that may be indexed. You can read up on these in the ...

Get Guru's Guide to SQL Server™ Stored Procedures, XML, and HTML, The 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.