Clustered vs Nonclustered Indexes in SQL
Difference between Clustered and Nonclustered index in relational database is one of the most popular SQL interview questions almost as popular as
difference between truncate and delete,
primary key vs unique key and
correlated vs noncorrelated subqueries. Indexes are very important concept, it makes your queries to run fast and if you compare a SELECT query which uses an indexed column to one who doesn't you will see big difference in performance. There can be two kinds on indexes in relational database
Clustered and
Nonclustered indexes. Clustered index determines physical sorting order of rows in a table similar to entries on yellow pages which are sorted on alphabetical order. Suppose you have a table Employee, which contains
emp_id as
primary key than clustered index which is created on primary key will sort the Employee table as per
emp_id. That was a brief introduction of
What is clustered index in SQL. On other hand Nonclustered index involves one extra step which point to physical location of record. In this SQL Interview question we will see some more difference between clustered and nonclustered index in point format.