Chapter 17
Multi level indexes
Because a single-level index is an ordered file, we can create a primary index to the index itself. In this case the original index file is called the first level index and the index to the index is called the second level index. we can repeat the process, creating a third, fourth,...top level until all entries of the top level fit in one disk block. A multi level index can be created for any type of first level index (primary, secondary, clustering) as long as the first level index consists of more than one disk block
Clustering Index
Defined on an ordered data file. The data file is ordered on non-key field unlike primary index, which requires that the ordering field of the data file have a distinct value for each record. Includes on index entry for each distinct value of the field; the index entry points to the first data block that contains records with that field value
Dense Index
Has an index entry for every search key value (and hence every record) in the data file
Sparce (nondense) index
Has index entries for some of the search values
properties of secondary key index types
Number of first level index entries = Number of records in data file Dense blocks anchoring on the data file = no
Properties of primary index Types
Number of first level index entries = number of blocks in data file Nondense blocks anchoring on the data file = yes
properties of clustering index types
Number of first level index entries = number of distinct index field values Nondense blocks anchoring on the data file = yes/no
properties of secondary non key types
Number of first level index entries = number of records or number of distinct index field values Dense or Nondense blocks anchoring on the data file = no
Primary Index
Ordered data file. Data file is ordered on a key field. Includes one index entry for each block in the data file; the index entry has the key field value for the first record in the block, which is called the block anchor. Similar scheme can use the last record in block. A primary index is a nondense 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.
Secondary Index
Provides a secondary means of accessing a file for which some primary access already exists. The secondary index may be on a field which is a candidate key and has a unique value in every record, or a non key with duplicate values. Index is ordered with two fields, the first being the same data type as some non ordering field of the data file. The second field is either a block pointer or a record pointer
single level index
an auxiliary file that makes it more efficient to search for a record in the data file. The index is usually specified on one field of the file, but it could be specified on more fields. One form of an index is a file of entries <field value, pointer to record> The index file usually occupies considerably less disk blocks than the data file because its entries are much smaller. A binary search on the index yields a pointer to the file record.
types of indexes based on the properties of the indexing field
if indexing field is key, primary key used for order and a secondary index is not used for ordering. If indexing field is nonkey the field used for ordering the filed is a clustering index, and a secondary index which is nonkey is not used for order
Non key non- ordering field for secondary indexes
option 1: duplicate index entries with the same K(i values.) dense index option 2: Variable length records for the index entries (repeating pointer) option 3: create extra level to handle the multiple pointers