Indexes on computed columns and indexed views

Without indexes, views and computed columns are purely logical. The data involved has no physical storage. A computed column isn’t stored with the table data; it’s recomputed every time a row is accessed (unless the computed column is marked as PERSISTED). A view doesn’t save any data; it instead saves a SELECT statement that’s executed every time the data in the view is accessed. With these indexes on views and computed columns, SQL Server actually materializes what was only logical data into the physical leaf level of an index.

Before you can create indexes on either computed columns or views, certain prerequisites must be met. The biggest issue is that SQL Server must be able to guarantee that given ...

Get Microsoft SQL Server 2012 Internals 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.