What is distributed database? Explain data fragmentation techniques in detail with suitable example.
Distributed database (DDB)
A distributed database (DDB) is a collection of multiple, logically interrelated databases distributed over a computer network. A distributed database management system (DDBMS) is the software that manages the DDB and provides an access mechanism that makes this distribution transparent to the users. The distributed database (DDB) and distributed database management system (DDBMS) together are called Distributed database systems (DDBS).
Data Fragmentation
Fragmentation is the task of dividing a table into a set of smaller tables. The subsets of the table are called fragments. These fragments may be stored at different locations. Moreover, fragmentation increases parallelism and provides better disaster recovery. Fragmentation can be of three types:
- Vertical Fragmentation
- Horizontal Fragmentation
- Hybrid Fragmentation
Fragmentation should be done in a way so that the original table can be reconstructed from the fragments. This is needed so that the original table can be reconstructed from the fragments whenever required. This requirement is called "reconstructiveness".
Vertical Fragmentation
In vertical fragmentation, the fields or columns of a table are grouped into fragments. In order to maintain re-constructiveness, each fragment should contain the primary key field(s) of the table. Vertical fragmentation can be used to enforce the privacy of data.
Example 4.1: Let us consider that a college management system keeps records of all registered students in a Student table having the following schema.
Now, the address details are maintained in the admin section. In this case, the designer will fragment the database as follows:
CREATE TABLE Std_address AS
SELECT Stu_id, Stu_address
FROM Student;
By executing the above query, we get the following result:
Horizontal Fragmentation
Example 4.2: In the student schema which is shown in figure 4.7 if the details of all students of department 1 need to be maintained at the respective faculty, then the designer will horizontally. fragment the database as follows:
CREATE TABLE Department AS
SELECT *FROM Student
WHERE Dept_id=1;
By executing the above query, we get the following result:
Hybrid Fragmentation
In hybrid fragmentation, a combination of horizontal and vertical fragmentation techniques is used. This is the most flexible fragmentation technique since it generates fragments with minimal extraneous information. However, reconstruction of the original table is often an expensive task. Hybrid fragmentation can be done in two alternative ways:
1. At first, generate a set of horizontal fragments; then generate vertical fragments from one or more of the horizontal fragments.
2. At first, generate a set of vertical fragments; then generate horizontal fragments from one or more of the vertical fragments.
Comments
Post a Comment