Indexed Views

SQL Server 2000 can create indexes on views. This functionality is implemented by extensions in the CREATE VIEW and CREATE INDEX statements. If a view is not indexed, it doesn't use any storage space. Whenever you use the view in a Transact-SQL statement, SQL Server merges the view definition with the statement to produce a single execution plan and it directly accesses the underlying tables on which the view is defined.

After a view is indexed, its index needsstorage space, as any standard index.

The process of creating an indexed view is as follows:

  1. Create the view with SCHEMABINDING, which prevents modifications on the definition of referenced objects.

  2. Create a clustered index on the view to physically save the view results in ...

Get Microsoft® SQL Server™ 2000 Programming by Example 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.