SQL Server Index Basics


Non Clustered and Clustered Index:

The primary key created for the StudId column will create a clustered index for the Studid column. A table can have only one clustered index on it. When creating the clustered index, SQL server 2005 reads the Studid column and forms a Binary tree on it. This binary tree information is then stored separately in the disc.

A non-clustered index is useful for columns that have some repeated values. Say for example, AccountType column of a bank database may have 10 million rows. But, the distinct values of account type may be 10-15. A clustered index is automatically created when we create the primary key for the table. We need to take care of the creation of the non-clustered index.

Recommendation:
-Indexes with INCLUDEs are a big win for frequently-called range queries.
-If access is always per-record on the clustered index, don’t add indexes with INCUDEs.
-For frequently called relatively-static data, consider using multiple indexes with INCLUDEs to cover different queries even if the KeyColumns are the same.
-Where you have created covering indexes where all the columns are in the KeyColumns, consider changing these indexes to have the minimal set of KeyColumns and the other columns in the IncludedColumns. This will lower the space requirements and speed the retrieval of records.


Ref:
sql/article.php/3787021/Exploring-SQL-Servers-Index-INCLUDEs.htm

Comments

Popular posts from this blog

Restoring Master, Model and MSDB from Netbackup

Oracle Job Operations