Wednesday, March 16, 2005SQL Server: Clustered indexes vs. non-clustered indexes
Today I learned some golden rules of indexes in SQL Server 2000. It seems I've been doing a bit of SQL Server stuff today!
Clustered indexes
- Use for columns that contain a large number of distinct values
- Queries that return large record sets
- Columns that are frequently found in WHERE clauses (BETWEEN, <=, =>, etc)
- Never use on a GUID column
Non-clustered indexes
- Use for columns that contain a large number of distinct values (if a clustered index already exists).
- Queries that do not return large record sets
- Queries that are frequently found in WHERE clauses (exact match)
»