Indexing Structures: Professor Navneet Goyal Department of Computer Science & Information Systems BITS, Pilani
Indexing Structures: Professor Navneet Goyal Department of Computer Science & Information Systems BITS, Pilani
search-key pointer
90
100
1
2
2
3
3 3
4 3
5
3
3
OPTION 1 4
5
4
4
5
3
6
8
7 6
8
Ordering Nonordering
Field Field
Key Field Primary Secondary Index
Index (key)
Nonkey Clustering Secondary Index
Field Index (nonkey)
* Yes if every distinct value of the ordering field starts from a new block; no otherwise
** For Option 1
*** For Options 2 & 3
© Prof. Navneet Goyal, BITS, Pilani
Multilevel Indexes
In all single level indexes, the index file
is always sorted on the search key
For an index with bi blocks, a binary
search requires approximately (log2 bi)
block accesses
The idea behind multilevel indexes is to
reduce the part of the index file that we
continue to search by a factor of bfri
(blocking factor)
10 2
Bucket C
11 10*
2
DIRECTORY
Bucket D
15* 7* 19*
2 2
3 2
00 1* 5* 21*13* Bucket B 000 1* 5* 21* 13* Bucket B
01 001
10 2 2
010
10* Bucket C
11 10*
011 Bucket C
100
2
DIRECTORY 101 2
Bucket D
15* 7* 19*
110 15* 7* 19* Bucket D
111
2
3
4* 12* 20* Bucket A2
DIRECTORY 4* 12* 20* Bucket A2
(`split image'
of Bucket A) (`split image'
of Bucket A)
© Prof. Navneet Goyal, BITS, Pilani
Points to Note
20 = binary 10100. Last 2 bits (00) tell us r
belongs in A or A2. Last 3 bits needed to tell
which.
Global depth of directory: Max # of bits needed to tell
which bucket an entry belongs to.
Local depth of a bucket: # of bits used to determine if an
entry belongs to this bucket.
When does bucket split cause directory doubling?
Before insert, local depth of bucket = global depth.
Insert causes local depth to become > global depth;
directory is doubled by copying it over and `fixing’
pointer to split image page. (Use of least significant bits
enables efficient doubling via copying of directory!)
M=3
mod 3
0 1 2 3