2011-09-14-TreeIndices

2011-09-14-TreeIndices - Tree-Structured Indexes Database...

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

View Full Document Right Arrow Icon
Database Management Systems, R. Ramakrishnan and J. Gehrke 1 Tree-Structured Indexes Database Management Systems, R. Ramakrishnan and J. Gehrke 2 Introduction 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. Database Management Systems, R. Ramakrishnan and J. Gehrke 3 Range Searches `` Find all students with gpa > 3.0 ’’ If data entries are sorted, do binary search to find first such student, then scan to find others. Problem? Page 1 Page 2 Page N Page 3 Data (Entries) File
Background image of page 1

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

View Full DocumentRight Arrow Icon
Database Management Systems, R. Ramakrishnan and J. Gehrke 4 Range Searches Simple idea: Create an `index’ file – What is search cost if each index page has F entries? Can do binary search on (smaller) index file! Page 1 Page 2 Page N Page 3 Data File k2 kN k1 Index File Database Management Systems, R. Ramakrishnan and J. Gehrke 5 ISAM Index file may still be quite large. But we can apply the idea repeatedly! Leaf pages contain data entries . P 0 K 1 P 1 K 2 P 2 K m P m index entry Non-leaf Pages Pages Overflow page Primary pages Leaf Database Management Systems, R. Ramakrishnan and J. Gehrke 6 Example ISAM Tree Each node can hold 2 entries – What is search cost if each leaf node can hold L entries and each index node can hold F entries? 10* 15* 20* 27* 33* 37* 40* 46* 51* 55* 63* 97* 20 33 51 63 40 Root
Background image of page 2
Database Management Systems, R. Ramakrishnan and J. Gehrke 7 After Inserting 23*, 48*, 41*, 42* . .. 10* 15* 20* 27* 33* 37* 40* 46* 51* 55* 63* 97* 20 33 51 63 40 Root 41* Overflow Pages Leaf Index Pages Pages Primary 23* 48* 42* Database Management Systems, R. Ramakrishnan and J. Gehrke 8 … Then Deleting 42* 10* 15* 20* 27* 33* 37* 40* 46* 51* 55* 63* 97* 20 33 51 63 40 Root 41* Overflow Pages Leaf Index Pages Pages Primary 23* 48* 42* Database Management Systems, R. Ramakrishnan and J. Gehrke 9 … Then Deleting 51* 10* 15* 20* 27* 33* 37* 40* 46* 51* 55* 63* 97* 20 33 51 63 40 Root 41* Overflow Pages Leaf Index Pages Pages Primary 23* 48*
Background image of page 3

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

View Full DocumentRight Arrow Icon
Database Management Systems, R. Ramakrishnan and J. Gehrke 10 After Deleting 41* and 51* 10* 15* 20* 27* 33* 37* 40* 46* 55* 63* 97* 20 33 51 63 40 Root 41* Overflow Pages Leaf Index Pages Pages Primary 23*
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 12/07/2011 for the course CS 4410 taught by Professor Vollset during the Spring '07 term at Cornell.

Page1 / 13

2011-09-14-TreeIndices - Tree-Structured Indexes Database...

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

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