Professional Documents
Culture Documents
Dbms. 5 Unit Part-B
Dbms. 5 Unit Part-B
Dbms. 5 Unit Part-B
B+ Tree are used to store the large amount of data which can not
be stored in the main memory.
Due to the fact that, size of main memory is always limited, the
internal nodes (keys to access records) of the B+ tree are stored
in the main memory.
whereas, leaf nodes are stored in the secondary memory.
**** 033*********
Advantages of B+ Tree
1. Records can be fetched in equal number of disk accesses.
2. Height of the tree remains balanced and less as compare to B
tree.
3. We can access the data stored in a B+ tree sequentially as well as
directly.
4. Keys are used for indexing.
5. Faster search queries as the data is stored only on the leaf nodes.
Insertion in B+ Tree
Step 1: Insert the new node as a leaf node
Step 2: If the leaf doesn't have required space, split the node and
copy the middle node to the next index node.
node
Step 3: If the index node doesn't have required space, split the
and copy the middle element to the next index page.
B+ Trees
Example
Insert the value 195 into the B+ tree of order 5
shown in the follbwing
figure.
78 120
* *************a*********
********T*
63 57 T*******T:**********| ******j*******r********, r*****
******
B8 110 119 200
208 A20
***
53 69
B8 - 110 119 129 100 195 200
*************11%*
60 18 120 90
-- ov*****
**.
**~-~
53 57
88 110 119 129 195 200
Now, the index node contains 6 children and 5 keys which violats t
B+ tree properties, therefore we need to
split it, shown as follows
B+ Trees
60
* w
***~
53 B9
***eme*r*****r*onpod 20
Deletion in B+ Tree
Step 1: Delete the key and data from the leaves.
Example
Delete the key 200 from the B+ Tree shown in the
following figure.
****
. *******
190
. www.o
4 53 57 69
"revwrnri9oittrmmtmvtrumriwnnubn
101s 195 200
200 is present in the right sub-tree of 190, after 195. delete it.
K
B+ Trees
~~************
2
***.
Merge the two nodes by using 195, 190, 154 and 129.
******** ****
60
wwww.*****.
r*****
43
H 69 H 110 -
Now, element 120 is the singile element present in the node which is
violating the B+ Tree properties. Therefore, we need to merge it by
using 60, 78, 108 and 120.
L 60 78 108 120
***
3 110 119 54 190
B+ Trees
File Organization
The File is a collection of records. Using the primary key, we can access
the records. The type and frequency of access can be determined by the
type of file organization which was used for a given set of records.
File organization is a logical relationship among various records. Thiss
method defines how file records are mapped onto disk blocks.
o File organization is used to describe the way in which the records are
stored in terms of blocks, and the blocks are placed on the storage
medium.
Files of fixed length records are easier to implement than the files of
variable length records.
************************************************
Fiie E}r#Arakz2AKLON
.**
****** **.***
e****** ******
*
*********. M . . . s****N
.
**************** *., ****W***"*****
ISAM ****.**** *********
****************************
******************"
***************************
*********
F
*** *****************
Number of indexes
Moreover, there is only one primary index, while
indexes. there can be
multiple seconday
Duplicates
There are no
duplicates in the primary index while there can be
secondary index. duplicates in th
Conclusion
In brief, there various types of
are
secondary index. The main difference indexes, and two of them are primay and
the between primary and
primary index is an index on a set of
field and does not secondary index is that
fields that includes the
contain primary for the
a
primary index and which duplicates,
can contain
while the
secondary index is an indexkey
duplicates. tha ist
B+ Trees
PRI1AR IN)E K
R SUS
PRIMARY INDEX
CONDARY INDE
Index en a sel of Helds tha lndes hat is not a primary
heledes the ttnique piimar
key and s guoiteed not ndendmay have
to ontnin dupicntes piicatee
File Organization
o The File is a collection of records. Using the primary key, we can access
the records. The type and frequency of access can be determined by the
type of file organization which was used for a given set of records.
File organization is a logical relationship among various records. This
method defines how file records are mapped onto disk blocks.
File organization is used to describe the way in which the records are
stored in terms of blocks, and the blocks are placed on the storage
medium.
File Organization
"
****
FO FO FO
uuuuuum