COMP306 #13 Tree Based Indexing

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/21

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

22 Terms

1
New cards

example ISAM Tree

2
New cards

structure of leag pages

only store data entries

3
New cards

structure of non-leaf pages:

pointers and keys.

4
New cards

non-leaf pages are

static

5
New cards

two types of leaf pages

primary pages and overflow pages

6
New cards

non-leaf pages act as

guides

7
New cards

leaf pages store

actual data entires

8
New cards

40 pointer meaning here

everything will be less than 40.

9
New cards

insertion into an isam tree

find where 23 belongs, start at the node, then 23 is between 20 and 33, then follow that pointer, but guess what the page is full, so create an overflow page,

10
New cards

deletion example

find 42 in the tree, delete it

11
New cards

why isam tree a static data strucutre?

because non-leaf pages don’t change (leaf pages and overflow pages might change).

12
New cards

what is the problem with static isam trees

the complexity is dependent on the insertion deletion order, initally it can be quite balanced but later on it might get shitty. long overflow chains (straight up linked list mate)

13
New cards

best case worst case complexities in an ISAM tree

O(logN), N.

14
New cards

B+ tree

self-balancing tree data strucutre that keeps data sorted and allows search sequential access, insertion and deletion in O(logN) time. commonly used in today’s DBMS

15
New cards

properties of B+ trees

perfectly height balanced at all timese
every node other than the root must be atleast half full
order = m means nodes have at most m children (thus each node holds at most m-1 data entrires)

16
New cards

example b+ tree

notice that there are pointers between leaf nodes.

17
New cards

the benefit of having pointers between leaf nodes

sequential thing:

i.e. we want to look at 24 first, then we scan to the right.

18
New cards

insertion in B+ trees

find the leaf node L to insert to

if L has enogh space: insert into L, ensure the leaf is sorted done! (since we can serach in the leaf nodes thats why they should be sorted.)

otherwise:
must split L into two nodes
redistribute entries evenly, copy up the middle key. this split may cause recurisve splits in the upper levels

to handle splits in the upper levels: redistribute entries evenly, push up the middle key
always check if the push up causes further splits.

19
New cards

inserting 8 into this tree

don’t forget the importance of pushing up vs copying up.

20
New cards

deletion in a B+ tree

start at the root, find leaf L where entry resides.

remove the entry from L

after remove if L is at least half full, done!

otherwise, try to redistribute by borrwon from L’s right sibling adjacent node with same parent as L
if re-distribution fails, merge L and its sibling

if merge occurs, we must delete the entry seperating L and its sibling from L’s parent

merge could propogate all the way up to the root and cause decreased tree height.

21
New cards

deletion example

should merge these cunts now.


22
New cards

bulk loading

if we have a large collection of records and we want to create a B+ tree with them, doing so by repeatedly inserting records in random order can be slow

can be solved by bulk loading of the B+ tree

sort all records, initalize empty root and start adding.

why: the left part of the B+ tree is not changing whatsoever (,ajority of the tree never changes).