Posts Tagged ‘Clustered indexes Vs Non-clustered indexes’

Clustered indexes Vs Non-clustered indexes

A clustered index is a special type of index that reorders the records in the table are physically stored. In non-technical way, you are telling the database to store close values to one another on the disk. This means, a table can have only one clustered index. This has the benefit of rapid scan / retrieval of records on any operation with clustered index values.

Writing to a table with a clustered index can reduce the speed, if clustered index is other than primary key. The reason is to rearrange the records.

For e.g.
I have two tables.
1) User
2) Order



If i need to get all orders of one user, than you can create clustered index on UserID of Order table. So all records of particular records will be physically stored to each other. This will speed up when we retrieve records.

A nonclustered index is a special type of index that stores the records in logical order rather than physical order. This means, a table can have many non clustered indexes. More non clustered indexes per table means more time it takes to write new records.

%d bloggers like this: