1.06k likes | 1.2k Vues
This document discusses advanced concepts of B-Tree operations in database systems, including insertion and deletion functionalities. It explains the procedures for inserting keys into leaf nodes, splitting leaf and internal nodes, and managing root node splits. Additionally, the document outlines deletion strategies, including deleting from leaf nodes, redistributing keys among sibling nodes, and merging nodes. This comprehensive overview is essential for understanding B-Tree structures and their use in efficient data access and storage management.
E N D
CPS216: Advanced Database Systems Notes 05: Operators for Data Access (contd.) Shivnath Babu
Insertion in a B-Tree n = 2 49 36 49 15 Insert: 62
Insertion in a B-Tree n = 2 49 36 49 62 15 Insert: 62
Insertion in a B-Tree n = 2 49 36 49 62 15 Insert: 50
Insertion in a B-Tree n = 2 49 62 36 49 50 62 15 Insert: 50
Insertion in a B-Tree n = 2 49 62 36 49 50 62 15 Insert: 75
Insertion in a B-Tree n = 2 49 62 36 49 50 62 75 15 Insert: 75
Insertion: Primitives • Inserting into a leaf node • Splitting a leaf node • Splitting an internal node • Splitting root node
Inserting into a Leaf Node 58 54 57 60 62
Inserting into a Leaf Node 58 54 57 60 62
Inserting into a Leaf Node 58 54 57 58 60 62
Splitting a Leaf Node 61 54 66 54 57 58 60 62
Splitting a Leaf Node 61 54 66 54 57 58 60 62
Splitting a Leaf Node 61 54 66 54 57 58 60 61 62
Splitting a Leaf Node 59 61 54 66 54 57 58 60 61 62
Splitting a Leaf Node 61 54 59 66 54 57 58 60 61 62
Splitting an Internal Node … 21 99 … 59 40 54 66 74 84 [54, 59) [ 59, 66) [66,74)
Splitting an Internal Node … 21 99 … 59 40 54 66 74 84 [54, 59) [ 59, 66) [66,74)
Splitting an Internal Node 66 … 21 99 … [66, 99) [21,66) 40 54 59 74 84 [54, 59) [ 59, 66) [66,74)
Splitting the Root 59 40 54 66 74 84 [54, 59) [ 59, 66) [66,74)
Splitting the Root 59 40 54 66 74 84 [54, 59) [ 59, 66) [66,74)
Splitting the Root 66 40 54 59 74 84 [54, 59) [ 59, 66) [66,74)
Deletion redistribute
Deletion - II merge
Deletion - II Not needed merge
Deletion: Primitives • Delete key from a leaf • Redistribute keys between sibling leaves • Merge a leaf into its sibling • Redistribute keys between two sibling internal nodes • Merge an internal node into its sibling
Merge Leaf into Sibling 72 … 85 67 54 58 64 68 72 75
Merge Leaf into Sibling 72 … 85 67 54 58 64 68 75
Merge Leaf into Sibling 72 … 85 67 54 58 64 68 75
Merge Leaf into Sibling 72 … 85 54 58 64 68 75
Merge Internal Node into Sibling … 59 … 41 63 74 48 52 [52, 59) [59,63)
Merge Internal Node into Sibling … 59 … 41 48 52 59 63 [52, 59) [59,63)