Da 2 Arunkumar
Da 2 Arunkumar
Da 2 Arunkumar
DIGITAL ASSIGNMENT -2
NAME: YUVASRI.R
COURSE CODE:
SLOT:
1.State the comparison and differences between Binary Search Tree (BST),
BTrees, and B+ Trees in a tabular format.
2. Explain in detail on the role of BST, B-Tree, and B+ Tree on the databases. In
physical database design, describe the Indexing, hashing on file systems and
detail the working principles of BST, B-Tree, and B+ Trees with relevant
database examples.
B-Tree:
B-Trees are widely used in database systems for indexing large datasets. They
are particularly well-suited for storing and retrieving data efficiently on disk or
other secondary storage devices.
B-Trees maintain balance through a set of rules governing the structure of the
tree, ensuring that all leaf nodes are at the same level and that nodes are well-
distributed throughout the tree.
In a B-Tree index, each node contains multiple keys and pointers, allowing for
efficient disk access patterns. This makes B-Trees ideal for databases where
data is stored on disk or other secondary storage devices.
B+ Tree:
B+ Trees are a variant of B-Trees optimized for disk-based storage systems.
They share many similarities with B-Trees but have certain differences in
structure.
In a B+ Tree, only leaf nodes contain actual data records, while internal nodes
are used solely for indexing. This ensures that leaf nodes are densely packed
with data records, improving disk I/O performance.
B+ Trees also maintain a sorted linked list of leaf nodes, facilitating efficient
range queries and sequential access.
Indexing and Hashing in Physical Database Design:
Indexing:
Indexing involves creating data structures (such as BSTs, B-Trees, or Hash
Tables) to optimize query performance by providing fast access paths to data.
In physical database design, indexes are typically stored alongside the actual
data, either in memory or on disk, to accelerate query processing.
Indexes can be created on one or more columns of a table, allowing for efficient
retrieval based on various criteria.
While indexing improves query performance, it comes with overhead in terms
of storage space and maintenance, as indexes need to be updated whenever the
underlying data changes.
B-Tree:
Example: Consider a database table containing millions of rows of customer
data, and we want to create an index on the "last_name" column.
The B-Tree index organizes the last names of customers in a balanced tree
structure, allowing for efficient lookup and range queries.
B-Trees ensure that disk I/O operations are minimized by maintaining balance
and optimizing node access patterns.
B+ Tree:
Example: In a file system used by a database, we want to create an index on the
"file_name" attribute.
The B+ Tree index would consist of internal nodes storing keys for navigation
and leaf nodes containing pointers to actual file records.
B+ Trees facilitate efficient range queries and sequential access due to the
sorted linked list of leaf nodes.