Friday, 27 June 2014

PHYSICAL DATA ORGANIZATION | PRIMARY INDEXES | DENSE INDEX |SPARSE INDEX


PRIMARY INDEXES-

a.) A Primary index is an ordered file whose records are of fixed length with two fields.
b.) The first field is of the same data type as the ordered key field called the primary key of the data file.
c.) The second field is a pointer to a disk block(a block address)
d.) There is one index entry (or index record) in the index file for each block in the data file.
e.) Each index entry has the value of the primary key field for the first record in a block and a pointer that block as its two field values.

INDEXES CAN BE CHARACTERIZED AS DENSE OR SPARSE.

1.) DENSE INDEX-A dense index has an index entry for every search key value (and hence entry record) in the data file. A dense index in databases is a file with pairs of keys and pointers for every record in the data file. Every key in this file is associated with a particular pointer to a record in the sorted data file. In clustered indices with duplicate keys, the dense index points to the first record with that key.

2.) SPARSE INDEX- A sparse index on the other hand, has index entries for only some of the search values.A sparse index in databases is a file with pairs of keys and pointers for every block in the data file. Every key in this file is associated with a particular pointer to the block in the sorted data file. In clustered indices with duplicate keys, the sparse index points to the lowest search key in each block.

Therefore a primary index is a non-dense 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).

0 comments:

Post a Comment