Difficulty: Easy
Correct Answer: Incorrect — performance depends on access patterns and design
Explanation:
Introduction / Context:
Index selection in SQL Server is workload-dependent. Clustered and nonclustered indexes offer different benefits. Absolutes like “nonclustered is faster” are misleading and can lead to suboptimal designs.
Given Data / Assumptions:
Concept / Approach:
Clustered indexes excel at range queries on the clustering key and can reduce lookups when the clustering key participates in predicates and joins. Nonclustered indexes can be faster for selective point lookups, especially when they are covering (include all needed columns). Neither is universally “faster.” Proper design considers selectivity, covering, write overhead, and fragmentation.
Step-by-Step Solution:
Evaluate workload: predicates, joins, order by, group by.Choose a clustering key that supports common range/group operations.Add nonclustered indexes to cover selective queries (INCLUDE columns as needed).Validate with execution plans and wait statistics.
Verification / Alternative check:
Compare logical reads with SET STATISTICS IO ON and observe plans using the clustered index vs. a covering nonclustered index.
Why Other Options Are Wrong:
“Always faster” is false; range scans are often better on clustered indexes; heaps change lookup mechanics but do not make NCI universally faster; MAXDOP is irrelevant to this absolute claim.
Common Pitfalls:
Over-indexing; ignoring INCLUDE columns; poor clustering key selection causing excessive key lookups.
Final Answer:
Incorrect — performance depends on access patterns and design
Discussion & Comments