Index types in SQL Server:\nJudge the statement:\n\n"SQL Server supports two kinds of indexes: clustered and nonclustered."

Difficulty: Easy

Correct Answer: Correct

Explanation:


Introduction / Context:
At the core of SQL Server’s traditional rowstore storage engine are two primary B-tree index organizations: clustered and nonclustered. Many specialized index types exist today, but they are generally built on or alongside these fundamental structures or serve different storage engines (e.g., columnstore).


Given Data / Assumptions:

  • We refer to the foundational B-tree index categories in the rowstore engine.
  • Specialized indexes (columnstore, XML, spatial, full-text) are recognized as additional features, not replacing the core dichotomy.
  • Heaps are tables without a clustered index.


Concept / Approach:
A clustered index defines the table’s physical row order; there can be at most one. Nonclustered indexes maintain a separate key order and reference the base table via a row locator (RID for heaps, clustering key for clustered tables). These two kinds underpin most tuning, covering, and seek strategies. While modern SQL Server versions add columnstore and others, the canonical answer for “kinds of indexes” in the classic sense remains clustered vs. nonclustered.


Step-by-Step Solution:

Create clustered index on primary key → defines row order.Create nonclustered index to accelerate predicates/joins → uses row locator to fetch rows.Recognize specialized indexes as complementary to (not replacing) the two main B-tree kinds.


Verification / Alternative check:
Examine sys.indexes; note type values for clustered (1) and nonclustered (2) in rowstore, alongside other types for specialized indexes.


Why Other Options Are Wrong:

  • Incorrect ignores the conventional classification.
  • Version/heap/compatibility caveats do not change the fundamental distinction.


Common Pitfalls:
Confusing heaps with an index type; assuming columnstore replaces B-trees universally; overusing nonclustered indexes without evaluating key/include design.


Final Answer:
Correct

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion