DBMS Unit-3
DBMS Unit-3
What is transaction?
A transaction is any operation that is treated as a single unit of work,
which either completes fully or does not complete at all, and leaves
the storage system in a consistent state. The classic example of a
transaction is what occurs when you withdraw money from your bank
account. Either the money has left your bank account, or it has not —
there cannot be an in-between state.
Explain ACID properties for transaction?
ACID Properties
1
DBMS UNIT-3,4
2
DBMS UNIT-3,4
3
DBMS UNIT-3,4
B Tree
B Tree is a specialized m-way tree that can be widely used for disk access.
A B-Tree of order m can have at most m-1 keys and m children.
A B tree of order m contains all the properties of an M way tree which
are-
• Every node in a B-Tree contains at most m children.
• Every node in a B-Tree except the root node and the leaf node
contain at least m/2 children.
• The root nodes must have at least 2 nodes.
• All leaf nodes must be at the same level.
A B tree of order 4 is shown in the following image.
4
DBMS UNIT-3,4
Operations
1. Searching- Searching in B Trees is similar to that in Binary search
tree. For example, if we search for an item 49 in the following B
Tree. The process will something like following:
• Compare item 49 with root node 78. since 49 < 78 hence, move to
its left sub-tree.
• Since, 40<49<56, traverse right sub-tree of 40.
• 49>45, move to right. Compare 49.
• match found, return.
5
DBMS UNIT-3,4
6
DBMS UNIT-3,4
Deletion
Deletion is also performed at the leaf nodes. The node which is to be
deleted can either be a leaf node or an internal node.
Example
Delete the node 53 from the B Tree of order 5 shown in the
following figure.
7
DBMS UNIT-3,4
8
DBMS UNIT-3,4
B+ tree
9
DBMS UNIT-3,4
B Tree
10