beginnerIndexes — Clustered, Non-Clustered, Composite, Covering

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

Clustered index: the table data is physically stored in the order of the index key. One per table. In SQL Server: every table has one clustered index (by default on PRIMARY KEY). In MySQL InnoDB: the primary key IS the clustered index. In PostgreSQL: no native clustered index; CLUSTER command physically reorders data once but doesn't maintain order on DML. Non-clustered index: a separate B-Tree st

Ready to master this question?

Generate a complete walkthrough — background, the full answer in plain language, a working code example explained line by line, a real-world scenario, common mistakes, and how this same question gets asked in different ways.

Sign in to generate a response

Next Step

Continue to What is the leftmost prefix rule for composite indexes?← Back to all SQL questions