Index
INDEX:¶
Indexes are used by queries to find data from tables quickly.
We can create indexes on tables or views .
1 2 | |
ex:
1 2 | |
CLUSTERED INDEX :¶
Clustered index determines the physical order of data on a table ,for this reason a table have only one clustered index.
If we create a primary key by default clustered index will be created.
1 2 | |
ex :
1 2 | |
NON CLUSTERED INDEX :¶
Nonclustered indexes have a structure separate from the data rows. A nonclustered index contains the nonclustered index key values and each key value entry has a pointer to the data row that contains the key value.
If we create unique key on table , by default non clustered index will be created.
1 2 | |
ex :
1 2 | |
UNIQUE INDEX :¶
Unique index enforces the umiqueness of the key values in the index.
By default primary key constraint creates a unique clustered index.
Uniqueness is a property of an index ,and both clustered and non clustered indexes can be unique.