442_Indexes

442_Indexes - Indexing CS442 TreeStructuredIndexes...

Info iconThis preview shows pages 1–10. Sign up to view the full content.

View Full Document Right Arrow Icon
Indexing CS 442
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Tree-Structured Indexes
Background image of page 2
Introduction As for any index, 3 alternatives for data entries  k* :  Data record with key value  k  < k , rid of data record with search key value  k >  < k , list of rids of data records with search key  k > Choice is orthogonal to the  indexing technique  used to locate data entries  k* . Tree-structured indexing techniques support  both  range searches  and  equality searches . ISAM :   static structure;    B+ tree :   dynamic,  adjusts gracefully under inserts and deletes.
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Range Searches `` Find all students with gpa > 3.0 ’’ If data is in sorted file, do binary search to find  first such student, then scan to find others. Cost of binary search can be quite high. Simple idea:  Create an `index’ file.   Can do binary search on (smaller) index file! Page 1 Page 2 Page N Page 3 Data File k2 kN k1 Index File
Background image of page 4
B+ Tree: Most Widely Used Index Insert/delete at log  F  N cost; keep tree  height- balanced .    (F = fanout, N = # leaf pages) Minimum 50% occupancy (except for root).  Each  node contains  d  <=   m   <= 2 d  entries.  The  parameter  d  is called the  order  of the tree. Supports equality and range-searches efficiently. Index Entries Data Entries ("Sequence set") (Direct search)
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Example B+ Tree Search begins at root, and key comparisons  direct it to a leaf. Search for 5*, 15*, all data entries >= 24* . ..   Based on the search for 15*, we know  it is not in the tree! Root 17 24 30 2* 3* 5* 7* 14* 16* 19* 20* 22* 24* 27* 29* 33* 34* 38* 39* 13
Background image of page 6
B+ Trees in Practice Typical order: 100.  Typical fill-factor: 67%. average fanout = 133 Typical capacities: Height 4: 133 4  = 312,900,700 records Height 3: 133 3  =     2,352,637 records Can often hold top levels in buffer pool: Level 1 =           1 page  =     8 Kbytes Level 2 =      133 pages =     1 Mbyte Level 3 = 17,689 pages = 133 MBytes       
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Inserting a Data Entry into a B+ Tree Find correct leaf  L.   Put data entry onto  L . If  has enough space,  done ! Else, must  split    L (into L and a new node L2) Redistribute entries evenly,  copy up   middle key. Insert index entry pointing to  L2  into parent of  L . This can happen recursively To split index node, redistribute entries evenly, but  push up   middle key.  (Contrast with leaf splits.) Splits “grow” tree; root split increases height.   Tree growth: gets  wider  or  one level taller at top.
Background image of page 8
Inserting 8* into Example B+ Tree Observe how  minimum  occupancy is  guaranteed in  both leaf and  index pg splits.
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 10
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/24/2011 for the course CS 442 taught by Professor Mlittman during the Fall '08 term at Rutgers.

Page1 / 33

442_Indexes - Indexing CS442 TreeStructuredIndexes...

This preview shows document pages 1 - 10. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online