Presentation is loading. Please wait.

Presentation is loading. Please wait.

CPSC 231 B+Trees (D.H.)1 LEARNING OBJECTIVES Indexes Sequential Access. A Sequence Set B+ tree. –How it works. –Advantages of B+trees over B-trees.

Similar presentations


Presentation on theme: "CPSC 231 B+Trees (D.H.)1 LEARNING OBJECTIVES Indexes Sequential Access. A Sequence Set B+ tree. –How it works. –Advantages of B+trees over B-trees."— Presentation transcript:

1 CPSC 231 B+Trees (D.H.)1 LEARNING OBJECTIVES Indexes Sequential Access. A Sequence Set B+ tree. –How it works. –Advantages of B+trees over B-trees.

2 CPSC 231 B+Trees (D.H.)2 Indexed Sequential Access A lot of applications require both : –fast key-based access –fast sequential access Example: –Student record system at universities –What operations in this system would require key-based access and what operations would require sequential access?

3 CPSC 231 B+Trees (D.H.)3 A Sequence Set A sequence set is an ordered set of records. When read in logical order, block after block, the sequence set lists all of the records in order by key.

4 CPSC 231 B+Trees (D.H.)4 Blocks The most efficient approach to maintaining a sequence set is to localize the changes by keeping records in blocks. When we block records, the block becomes the basic unit of input and output.

5 CPSC 231 B+Trees (D.H.)5 Block Structure and Organization Each block includes one or two link fields (pointer to the previous and to the next block) When blocks overflow they require splitting. When blocks underflow they require merging or redistribution of records. See example fig 10.1 p. 427.

6 CPSC 231 B+Trees (D.H.)6 Factors to consider when choosing the block size Several blocks should fit into main memory. WHY? Reading in or writing a block should be fast. Reading records within a single block should not require an extra seek time. WHY?

7 CPSC 231 B+Trees (D.H.)7 B+Tree A B+ Tree consists of a sequence set of records that are ordered by key, along with an index set that provides indexed access to the records. All of records are sorted in the sequence set. Insertions and deletions of records are handled by splitting, concatenating, and redistributing blocks in the sequence set. The index set which is used only as a finding aid in the sequence set, is managed as a B Tree.

8 CPSC 231 B+Trees (D.H.)8 Separators Instead of Keys Separators are derived from keys of records on either side of block boundary in the sequence set. If a given key is in one of the two adjacent blocks, the separator exactly tells in which block the key is located. Example: Consider the following two blocks: –Block 1: Aboutab, Adams, Berne, Binkowsky –Block 2: Bolen, Bree, Cong, Chung – A separator between these two blocks is “Bo”

9 CPSC 231 B+Trees (D.H.)9 Search key vs. separator Relation Decision Key< separatorGo left Key= separatorGo right Key> separatorGo right

10 CPSC 231 B+Trees (D.H.)10 Index set Index set consists of separators that provide information abound boundaries between the blocks in the sequence set of a B+ Tree. The index set can locate the block in the sequence set that contains the record corresponding to a certain key.

11 CPSC 231 B+Trees (D.H.)11 The Simple Prefix B+Tree The simple prefix B+Tree is a B+Tree in which the index set is made up of shortest separators that are simple prefixes of keys. See example fig 10.7 p.434

12 CPSC 231 B+Trees (D.H.)12 Characteristics of B-Trees and B+Trees They maintain height-balanced trees. They are built from the bottom up. They use paged (node-based) index structures. They can be adapted for use with variable size records.

13 CPSC 231 B+Trees (D.H.)13 Primary Advantages of B+Trees over B Trees They support true indexed sequential access. The index set contains fewer elements (one per block instead of one per data record) and hence can be smaller and shallower.


Download ppt "CPSC 231 B+Trees (D.H.)1 LEARNING OBJECTIVES Indexes Sequential Access. A Sequence Set B+ tree. –How it works. –Advantages of B+trees over B-trees."

Similar presentations


Ads by Google