RSS

Monthly Archives: June 2012

Indexes

Heap: A crude stack of data with a row identifier as a pointer to the storage location. This data is not ordered or searchable except by walking through the adta, row by row- scan.

When a clustered index is placed on a table, the key values of the index establish an order for the data. Further, with a clustered index, the data is stored with the index so that the data itself is now ordered. When a clustered index is present, the pointer on the non clustered index consists of the values that define the clustered index.

Tables with indexes require more storage and memory space for the index pages in addition to the data pages of the table. DML statements take longer and more processing time is required to maintain the indexes of constantly changing tables. This is because, unlike a SELECT statement, data manipulation queries modify the data content of a table. If an INSERT statement adds a row to a table, then it also has to add a row in the index structure. If the index is a clustered index, the overhead is greater still, because the row has to be added to the data pages themselves in thr right order, which may require other data rows to be repositioned below the entry position of the new row.

CLUSTERED INDEX
The main difference between the two types (clustered and non clustered index) is that the leaf pages in a clustered index are the data pages of the table and are therefore in the same order as the data to which they point. This means that the clustered index IS the table.The leaf pages of a clustered index and the data pages of the table the index is on, are one and the same. Because of this, table rows are physically sorted on the clustered index column, and since there can only be one physical order of the table data, a table can have only one clustered index.

Very good article about indexes and covering indexhttp://www.simple-talk.com/sql/learn-sql-server/using-covering-indexes-to-improve-query-performance/