views:

206

answers:

5

Whats the alternate approach to indexed views in sql server?

Thanks, Salman Shehbaz.

A: 

duplicate the actual query everywhere, using the real tables

KM
+1  A: 

Dumping the view contents to summary tables and putting indices on those instead.

What benefit is it that indexed views provide you with that you'd like to try and achieve with an alternative approach

Eoin Campbell
A: 

create a select stored procedure and then execute the stored procedure whever you need it.

DForck42
A: 

I will assume you want to index a view with an outer or self join (or one of the other limitations).

Use a normal view or in-line table function if you want to use it in a FROM clause.

However, remember this: In a query with indexed views, the optimiser may unnest (expand) the view and use the base tables if it sees fit. An alternative query using unindexed views or in-line table functions would also be nnested.

See my answer here: Does query plan optimizer works well with joined/filtered table-valued functions And Tony Rogerson

Otherwise, can you add more info please.

gbn
A: 

Alternative approaches inlcude using an INSTEAD OF trigger on a regular VIEW and using a regular trigger on the base tables.

onedaywhen