Skip to content
LakeBench
ProblemsCommunityPricing
Sign inStart practicing
Back
  1. Home
  2. Interview prep
  3. Clustered vs non-clustered index

SQL · Query Optimization

Clustered vs non-clustered index

Hardsql-35
clustered indexnon-clusteredindex

Question

What is the difference between a clustered and a non-clustered index?

Solution

A clustered index determines how the table's rows are physically/logically organized around the index key, depending on the database implementation.

A non-clustered index is a separate index structure that points to the underlying rows.

A table usually gets only one clustered organization/index, because the rows cannot be physically ordered two different ways at once.

It can have many non-clustered indexes.

Note: exact clustered-index behavior differs by database.

🎯 Put this concept into practice

Solidify this answer with real hands-on interview drills in the browser studio.

Open related drill →
PreviousNext