Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between an table index and a view index?

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

like image 336
Amutha Avatar asked Apr 07 '10 19:04

Amutha


People also ask

What is the difference between table and view?

A view is a database object that allows generating a logical subset of data from one or more tables. A table is a database object or an entity that stores the data of a database. The view depends on the table. The table is an independent data object.

What is a view index?

Indexed View(s) An indexed view is a view where the result set from the query (the view definition) becomes materialized in lieu of the virtual table result set of a standard (non-indexed) view. Many times we see that an indexed view would be created to help improve performance.

What is difference between index and table?

A table of contents is a list of the parts of a book or document while an index is a list of important words, concepts, and other useful materials in a book or document.

What is a table index?

Table indexes work the same way as an index in a book does, allowing you to quickly find information contained in the table. Table indexes are commonly made by using one column in a table, but can also contain more than one column. Indexed columns are the columns that are used within your queries to find information.


1 Answers

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.

like image 104
marc_s Avatar answered Sep 20 '22 01:09

marc_s