I need to know how the primary index is classified as a sparse index?

The sparse index as described by some aticles and books has index entries for only some of the search values and has a fewer entries than the number of records in the file. When you make the primary key you choose a column that will include a unique value for each record entry. So when you make and index on that key there must an index entry for each unique value.

So how the primary index is classified as a sparse index that has only some of entries?!!!

Recommended Answers

All 2 Replies

A primary index cannot be a sparse index as primary indexes cannot hold NULL values.
You can use a sparse column as part of a clustered key though.
Is that what you are asking?

Indexes can also be characterized as dense or sparse. A dense index has an index entry for every search key value (and hence every record) in the data file. A sparse (or nondense) index, on the other hand, has index entries for only some of the search values. A sparse index has fewer entries than the number of records in the file. Thus, a primary index is a nondense (sparse) index, since it includes an entry for each disk block of the data file and the keys of its anchor record rather than for every search value (or every record).

Fundamentals of Database Systems, 6th Edition

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.