Explain real time situation where you would use clustered and Non-clustered Indexes?

Showing Answers 1 - 6 of 6 Answers

RAGHUKANTH

  • Aug 21st, 2007
 

Yes, coming to your answer clustered index is used and applied only and primary keys

For example if a table student is created consider here in this table student id is the primary key so clustered index is applied on the student id column.

Coming to non-clustered index consider other table employee table here employee id is the primary

Key and it is foreign key for student table and there may be more than one foreign key so non-clusterd index is applied on foreign key  and candidate keys.

  Was this answer useful?  Yes

kirangiet

  • Aug 16th, 2010
 

Cluster Index should be created on unique columns. By default it will be created on Primary Key. We can change it to any other column. 

Note: We can create Clustered Key on Non-Unique column also. However it will not server the purpose of clustered index efficiently. 

Non-Clustered Index should be created on the columns which will be used with Where, Order By and Group By  keywords. It will fasten the search.

Imagine a product table with Productid, Producttype, Price, QuantityAvailable columns
Clustered Index: Productid 
Non-Clustered Index: Producttype, If I am using it in my select query.

Note: Index will slow down insertion and deletion process.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions