1 / 13

Announcements

Announcements. Today Finish up B+ Trees Relational Data Model Reading assignment from last time Chapter 5 and Sections 6.0-6.5 Exam 2 weeks from this coming Monday Program 2 coming next week Replace homework with powerpointizing lecture Buffer Manager operations + LRU (a few weeks back)

holt
Download Presentation

Announcements

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Announcements • Today • Finish up B+ Trees • Relational Data Model • Reading assignment from last time • Chapter 5 and Sections 6.0-6.5 • Exam • 2 weeks from this coming Monday • Program 2 coming next week • Replace homework with powerpointizing lecture • Buffer Manager operations + LRU (a few weeks back) • B+ Tree concepts (today)

  2. Trees

  3. B+ Blocks form a Balanced Tree Picture of B+ Tree Goes Here

  4. B+ Tree Properties • A B+ tree is kept balanced (ie, distance from the root to leaf is the same for each leaf) • Let p be the maximum number of tree pointers on an internal block (the order of the B+Tree) • Other than root, each internal page has at least ceil(p/2) tree pointers • A block with q tree pointers has q-1 search field values • Key aspect of B+ trees are graceful algorithms for handling insertions and delete

  5. Leaf Nodes • Together, leaf nodes are very similar to a secondary index Leaf Nodes Picture

  6. Internal Nodes • Internal nodes contain records (key, treePtr) pairs where treePtr points to root of B+Tree for records whose key value falls in some range Internal Nodes Picture

  7. Example 6: Calculating the order of a B+Tree • Recall that the order of a B+ tree is the maximum number of tree pointers in a block • What does it depend on?

  8. Key Operations on B+Tree(or any index for that matter) • Search: given key return RIDs • Ordered Scan: return RIDs in order of key field • Insert: and an entry to the index • Delete: remove an entry from the index

  9. B+Tree Search B+Tree_search( key ) B  root block of B+Tree while( B is not a leaf node ) if( key > B.keyq-1 ) B = *(B.Tq) else{ k = 1; while( key >= B.keyk && k <= q-1 ){ k++; } B = *B.Tk } } find and return RID on leaf page B

  10. B+Tree Insert B+Tree Insert Animation

  11. B+Tree Delete (see textbook)

  12. Misc. Thoughts on Indexes • For a frequently updated file, B+Tree index is almost always superior to a sorted file • For small amount of space, we get all the advantages of sorted files plus efficient insertion and deletion • On average B+trees are ~ 67% full • Bulk loading index Vs incremental construction • B+trees Vs other multilevel indexes • MLI blocks typically sequentially allocated, B+Tree usually not • Key Compression – internal nodes of B+Tree need not store full values • Indexes on multiple fields

More Related