Clustered vs Non clustered index

Share on facebook
Share on twitter
Share on linkedin
Share on pinterest

Clustered Index

1. A table can contain only one clustered index

2. On creation of primary key clustered index will be created automatically

3. Clustered index store the data in sequential order Dec /Asc

4. A clustered index can be applied to more than one columns that are called composite clustered index

Example Composite clustered index:

Create clustered index  emp_name_email on Employee(Name desc,Email asc)

Non clustered index

Non clustered index store in the different table with index column and row address
———————

ID Name      Email

———————————

1  A      g@gmail.com

2  B      b@gmail.com

3  C      c@gmail.com

———————————
Non clustered index table

————————

Name RowAddressed

————————

B             Row Address

————————
A clustered index is faster then nonclustered index why?

because of nonclustered index store data in the separate table so it has to look to the main table for looking for other columns details so it will require on more lookup to the master table.

Share on facebook
Share on twitter
Share on linkedin
Share on pinterest
Share on whatsapp
Share on email

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Recommended for you
Connect With Us
Stay Connected
Subscribe to our newsletter today to receive updates on latest tech news, tutorials SEO tips many more.
Latest Articles