What is an Index? (Clustered vs Non-Clustered)
Database Indexes: Clustered vs Non-Clustered
Indexes are B-tree structures designed to locate records in O(log N) time, bypassing costly full table scans.
Comparison Table
| Attribute | Clustered Index | Non-Clustered Index |
|---|---|---|
| Quantity per Table | Exactly ONE | Multiple allowed (e.g. up to 999) |
| Physical Order | Sorts actual rows on disk | Independent separate structure |
| Leaf Nodes | Contain actual data rows | Contain pointers to data rows |
| Default Creation | Created on PRIMARY KEY | Created manually or on UNIQUE |
| Lookup Speed | Fastest for range queries | Requires secondary pointer lookup |