0

I know a HEAP is a table without a clustered index. But I'm not quite clear on the following definition from sys.indexes.

I understand that this system view contains row per index of a tabular object. But I get confused when I read, "contains a row per index or heap."

Question

Why is the document using the word heap in the following definition, why per index or heap?

Contains a row per index or heap of a tabular object.

Ref: sys.indexes

1 Answer 1

2

A heap is a table without a clustered index. Because there is no ordering to the pages, it is a commonly accepted term to describe them. It can be confusing to people coming from other programming languages, where a heap refers to an entirely different type of entity.

Note that a table without a clustered index may have a nonclustered primary key, but the base object will still be a heap.

Adding a clustered index logically orders the table by the clustered index key(s).

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.