1 / 38

CS3223 Tutorial 2

CS3223 Tutorial 2. Fan Qi fan.qi@nus.edu.sg Database Lab 1, com1 #01-08. B+ Tree . Data Entry: Format 1: actual data record Format 2: key + RID Format 3: key, RID-List Properties & Attributes: Height Balanced Every node except root must be half full, [ d,2d]

ivory-chen
Download Presentation

CS3223 Tutorial 2

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. CS3223 Tutorial 2 Fan Qi fan.qi@nus.edu.sg Database Lab 1, com1 #01-08

  2. B+ Tree • Data Entry: • Format 1: actual data record • Format 2: key + RID • Format 3: key, RID-List • Properties & Attributes: • Height Balanced • Every node except root must be half full, [d,2d] • Fanout: # of pointers out of a non-leaf node

  3. B+ Tree • Operations: • Search: • Insert: If siblings do not have space, split • Delete: If siblings are just of d, Merge, else borrow one (redistribution) Redistribution in insertion is not frequently used in practice

  4. Question 1

  5. Question 1 g): Insert 59

  6. Question 1 g): Insert 59

  7. Question 1 g): Insert 59

  8. Question 1 g): Insert 59

  9. Question 1 g): Insert 59 Delete 91

  10. Question 1 g): Insert 59 Delete 91

  11. Question 1 g): Insert 59 Delete 91

  12. Question 1 g): Insert 59 Delete 91 Underflow!

  13. Question 1 g): Insert 59 Delete 91 Redistribution Failed Merge!

  14. Question 1 g): Insert 59 Delete 91 Underflow again!

  15. Question 1 g): Insert 59 Delete 91 Redistribution

  16. Question 2 • Find level of tree:

  17. Question 3 a): Get all records with key C A B

  18. Question 3 a): Get all records with key C A B

  19. Question 3 a): Get all records with key C A B

  20. Question 3 a): Get all records with key C A B

  21. Question 3 b): Insert a recode with key 109 C A B Split!!

  22. Question 3 b): Insert a recode with key 109 C A B

  23. Question 3 d):Which value would result Increasing in tree height? C A B 65-79, assume internal nodes do not re-distribute

  24. Question 4 11, 5, 3, 31,19,2,7,17,23,29,4,50,40,44 Top-down

  25. Question 4 11, 5, 3, 31,19,2,7,17,23,29,4,50,40,44 Top-down

  26. Question 4 11, 5, 3, 31,19,2,7,17,23,29,4,50,40,44 Top-down Split

  27. Question 4 11, 5, 3, 31,19,2,7,17,23,29,4,50,40,44 Top-down

  28. Question 4 11, 5, 3, 31,19,2,7,17,23,29,4,50,40,44 Top-down Split

  29. Question 4 11, 5, 3, 31,19,2,7,17,23,29,4,50,40,44 Top-down

  30. Question 4 11, 5, 3, 31,19,2,7,17,23,29,4,50,40,44 Top-down Split

  31. Question 4 11, 5, 3, 31,19,2,7,17,23,29,4,50,40,44 Top-down Split

  32. Question 4 11, 5, 3, 31,19,2,7,17,23,29,4,50,40,44 Top-down

  33. Question 4 11, 5, 3, 31,19,2,7,17,23,29,4,50,40,44 Top-down Split

  34. Question 4 11, 5, 3, 31,19,2,7,17,23,29,4,50,40,44 Top-down Further Split

  35. Question 4 11, 5, 3, 31,19,2,7,17,23,29,4,50,40,44 Bulk Loading Pros and Cons ?

  36. Self Thinking Question • When data has duplication, how to handle it in B+ tree ? • Try to implement a B+ tree by yourself 

  37. B+ Tree In Reality

  38. Further Doubts? • TA Contact: • Fan Qi • fan.qi@nus.edu.sg • Database Lab 1, com1 #01-08 Happy Chinese New Year !

More Related