Programming

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

Short answer

A clustered index physically sorts and stores the table’s data rows in index order (only one per table), while a non-clustered index is a separate structure that just points back to the data, and a table can have several.

Both types of index speed up lookups, but they work at a different level.

Clustered index

Determines the physical order data is stored on disk — the table's rows are literally sorted according to this index. Because the data can only be physically sorted one way, a table can have only one clustered index (often built automatically on the primary key).

Non-clustered index

A separate structure that stores the indexed column's values along with a pointer back to where the actual row lives. A table can have several non-clustered indexes, each optimized for different query patterns.

A simple analogy

A clustered index is like a phone book where entries are physically printed in alphabetical order by last name — there's only one possible physical order. A non-clustered index is like the index at the back of a textbook — it points you to the right page, but the book's pages themselves aren't reordered.

Last reviewed: September 2026