views:

49

answers:

2

I am quite confused about the difference between an index on table and index on view (Indexed View). Please clarify it.

+3  A: 

There really is none. The index on both table or view basically serves to speed up searches.

The main thing is: views normally do not have indices. When you add a clustered index to a view, you're basically "materializing" that view into a system-maintained, always automatically updated "pseudo-table" that exists on disk, uses disk space just like a table, and since it's really almost a table already, you can also add additional indices to an indexed view.

So really - between a table and an indexed view, there's little difference - and there's virtually no difference at all between indices on tables and an indexed view.

marc_s
A: 

Indexes on views have some restrictions, because views can be based upon various combinations of tables and views.

In either case, they are similar, and as underlying data changes, indexes may or not need to be updated.

Indexes on table are generally always used - typically you will have at least one unique index (primary key) and may have identified one of the indexes to be clustered.

Indexes on views are generally only applied as an optimization technique as view reads become heavy, indexes on the view can improve performance using the views.

Cade Roux