patternsqlModerate
What is a Clustered Index?
Viewed 0 times
clusteredwhatindex
Problem
I need a short explaining of clustered index.
- What is a clustered index?
- What are best practices for using the clustered index?
Solution
In simple terms...
A telephone directory: the data is the index/the index is the data. To look you up, I'd start with Rezaei, Amir for example. No external lookup is needed.
In database terms:
The table data and clustered index are one and the same (in SQL Server, also InnoDB, Oracle IOT)
Best practice is narrow, numeric, strictly increasing (think IDENTITY or Autonumber column). Data types like GUIDs are not a good idea
Links to read (to avoid bloating this answer)
Edit, to fully explain my best practice suggestions, follow the link in Eric Humphrey's comment: Queen of Indexing: Kimberly Tripp
A telephone directory: the data is the index/the index is the data. To look you up, I'd start with Rezaei, Amir for example. No external lookup is needed.
In database terms:
The table data and clustered index are one and the same (in SQL Server, also InnoDB, Oracle IOT)
Best practice is narrow, numeric, strictly increasing (think IDENTITY or Autonumber column). Data types like GUIDs are not a good idea
Links to read (to avoid bloating this answer)
- "Effective Clustered Indexes" (Simple Talk)
- Wikipedia
- MSDN (SQL Server 2000)
- MSDN (SQL Server 2005+)
Edit, to fully explain my best practice suggestions, follow the link in Eric Humphrey's comment: Queen of Indexing: Kimberly Tripp
Context
StackExchange Database Administrators Q#866, answer score: 15
Revisions (0)
No revisions yet.