Ch10 Tree Index-95
Ch10 Tree Index-95
Ch10 Tree Index-95
Index Entries
(Direct search)
Data Entries
("Sequence set")
atabase Management Systems 3ed, R. Ramakrishnan and J. Gehrke
Example B+ Tree
13 17 24 30
2* 3* 5* 7* 14* 16* 19* 20* 22* 24* 27* 29* 33* 34* 38* 39*
13 17 24 30
2* 3* 5* 7* 14* 16* 19* 20* 22* 24* 27* 29* 33* 34* 38* 39*
13 17 24 30
2* 3* 5* 7* 14* 16* 19* 20* 22* 24* 27* 29* 33* 34* 38* 39*
2* 3* 5* 7* 8*
5 13 17 24 30
2* 3* 14* 16* 19* 20* 22* 24* 27* 29* 33* 34* 38* 39*
5* 7* 8*
5 13 24 30
2* 3* 5* 7* 8* 14* 16* 19* 20* 22* 24* 27* 29* 33* 34* 38* 39*
occupancy is
guaranteed in 2* 3* 5* 7* 8*
both leaf and
index pg splits.
Note difference
between copy- Entry to be inserted in parent node.
(Note that 17 is pushed up and only
up and push- 17
appears once in the index. Contrast
this with a leaf split.)
up; be sure you
understand the
5 13 24 30
reasons for this.
Root
17
5 13 24 30
2* 3* 5* 7* 8* 14* 16* 19* 20* 22* 24* 27* 29* 33* 34* 38* 39*
5 13 24 30
2* 3* 5* 7* 8* 14* 16* 20* 22* 24* 27* 29* 33* 34* 38* 39*
Root
17
5 13 24 30
2* 3* 5* 7* 8* 14* 16* 22* 24* 27* 29* 33* 34* 38* 39*
17
5 13 27 30
2* 3* 5* 7* 8* 14* 16* 22* 24* 27* 29* 33* 34* 38* 39*
Root
17
5 13 27 30
2* 3* 5* 7* 8* 14* 16* 22* 24* 27* 29* 33* 34* 38* 39*
Underflow!
Can we do redistribution?
MERGE!
22
5 13 17 20 30
2* 3* 5* 7* 8* 14* 16* 17* 18* 20* 21* 22* 27* 29* 33* 34* 38* 39*
20
5 13 17 22 30
2* 3* 5* 7* 8* 14* 16* 17* 18* 20* 21* 22* 27* 29* 33* 34* 38* 39*
atabase Management Systems 3ed, R. Ramakrishnan and J. Gehrke 2
After Re-distribution
Intuitively, entries are re-distributed by
`pushing through’ the splitting entry in the
parent node.
We’ve re-distributed 17 as well for
illustration. Root
17
5 13 20 22 30
2* 3* 5* 7* 8* 14* 16* 17* 18* 20* 21* 22* 27* 29* 33* 34* 38* 39*
atabase Management Systems 3ed, R. Ramakrishnan and J. Gehrke 2
Prefix Key Compression
Important to increase fan-out. (Why?)
Key values in index entries only `direct traffic’; can
often compress them.
E.g., If we have adjacent index entries with search key
values Dannon Yogurt, David Smith and Devarakonda
Murthy, we can abbreviate David Smith to Dav. (The
other keys can be compressed too ...)
• Is this correct? Not quite! What if there is a data entry Davey
Jones? (Can only compress David Smith to Davi)
• In general, while compressing, must leave each index entry
greater than every key value (in any subtree) to its left.
Insert/delete must be suitably modified.
3* 4* 6* 9* 10* 11* 12* 13* 20* 22* 23* 31* 35* 36* 38* 41* 44*
3* 4* 6* 9* 10* 11* 12* 13* 20* 22* 23* 31* 35* 36* 38* 41* 44*