B+-Tree Index Files



next up previous
Next: B-Tree Index Files Up: Indexing & Hashing Previous: Secondary Indices

B-Tree Index Files

  1. Primary disadvantage of index-sequential file organization is that performance degrades as the file grows. This can be remedied by costly re-organizations.

  2. B-tree file structure maintains its efficiency despite insertions and deletions, but it also imposes some overhead.

  3. A B-tree index is a balanced tree in which every path from the root to a leaf is of the same length.
  4. Figures 8.8 (textbook fig. 8.9) and textbook fig. 8.10 show B-trees for the deposit file with =3 and =5.

     
    Figure 8.8:   B+-tree for file with .

  5. Processing Queries in a B-Tree

    Suppose we want all records with a search key value of .

  6. In processing a query, we traverse a path from the root to a leaf node. If there are search key values in the file, this path is no longer than .

    This means that the path is not long, even in large files. Reasonable values for are from 10 to 100 (or even larger). This allows a 3 to 9 level lookup for a file with a million search key values.

  7. Insertions and Deletions:

    Insertion and deletion are more complicated, as they may require splitting or combining nodes to keep the tree balanced. If splitting or combining are not required, insertion works as follows:

    If splitting or combining are not required, deletion works as follows:
  8. Insertions Causing Splitting:

    When insertion causes a leaf node to be too large, we split that node. In figure 8.9, assume we wish to insert a record with a bname value of ``Clearview''.

  9. Deletions Causing Combining:

    Deleting records may cause tree nodes to contain too few pointers. Then we must combine nodes.

  10. To summarize:



next up previous
Next: B-Tree Index Files Up: Indexing & Hashing Previous: Secondary Indices



Page created and maintained by Osmar R. Zaï ane
Last Update: Wed Nov 15 11:12:38 PST 1995