Professional Documents
Culture Documents
Structure
4.0 Objectives
4.1 Introduction
4.2 Reference Architecture for distributed databases
4.3 Types of data fragmentation
4.3.1 Horizontal Fragmentation
4.3.2 Derived Horizontal Fragmentation
4.3.3 Vertical Fragmentation
4.3.4 Mixed Fragmentation
4.4 Integrity Constraints in Distributed Databases
4.5 Summary
4.0 Objectives: In this unit we will learn the following topics:
4.1 Introduction:
In this unit we suggest reference architecture for the distributed database. This
architecture allows us to determine the different levels of transparency, which are
conceptually relevant to understand distributed databases. Also the mapping between
the different levels is defined. Here we have used the relational model and relational
algebra for this purpose. The distributed access primitives are represented using the
SQL statements, as it is user friendly. The emphasis is given to the fact that how the
SQL primitives reference the objects which constitute the database. The different
types of fragmentation methods are discussed. Also the integrity constraints in the
distributed transaction are explained.
4.2 Reference Architecture for Distributed Databases:
Here we have suggested reference architecture for the distributed databases as shown
in the fig.4.1.The different levels are conceptually helpful to understand the
functioning of the whole system. The various stages of the architecture are as follows.
Global Schema: defines all the data, which are contained in the
distributed database as if it is a centralized system. Here a set of global
relations is used.
Fragmentation Schema: Each global relation is split into several nonoverlapping portions that are called as Fragments. The mapping between
the global relations and fragments is defined in the Fragmentation Schema.
It is a one to many relation such that several fragments correspond to one
global relation but only one global relation corresponds to one fragment.
They are indicated as Ri, the ith fragment of the global relation R.
Allocation Schema: The fragments are really the logical portions of the
global relation, which are physically dispersed at different sites of the
network. This schema defines at which site(s) a fragment is allocated. It is
to be noted that depending upon the requirement more than one fragment
may be allocated at a site. So this mapping determines whether the system
is a Redundant system or a Non redundant system.
Global
Schema
Fragmentation
Schema
Site
Independent
Schemas
Allocation
Schema
(Other sites)
Local
Mapping
Schema 1
DBMS of
Site 1
Local
database
Local
Mapping
Schema 2
.
.
.
.
DBMS of
Site 2
Local
database
at site 1
at site 2
Fig. 4.1 A reference architecture for distributed databases
This architecture provides a very general conceptual framework for understanding
distributed databases. The three most important objectives that motivate the features
of this architecture are the separation of data fragmentation and allocation, the control
of redundancy, and the independence from local DBMSs.
transparency,
is
replication
transparency.
Replication
where SNUM is a supplier number. If it is required that a fragment has to contain the
tuples for suppliers, which are in a given city, and then we have to go for derived
fragmentation. A semi-join operation with the fragments SUPLIER1 and SUPLIER2
is needed in order to determine the tuples of SUPPLY, which correspond to the
suppliers in a given city. The derived fragmentation of SUPPLY can be therefore
defined as follows:
SUPPLY1 = SUPPLY SJSNUM=SNUMSUPPLIER1
SUPPLY2 = SUPPLY SJSNUM=SNUMSUPPLIER2
The reconstruction of the global relation SUPPLY can be performed through the
union operation as was shown for SUPPLIER.
The completeness of the above fragmentation requires that there be no supplier
numbers in the SUPPLY relation, which are not contained also in the SUPPLIER
relation. This is a typical, and reasonable, integrity constraint for this database and
usually is called as the referential integrity constraint.
The disjoint ness condition is satisfied if a tuple of the SUPPLY relation does not
correspond to two tuples of the SUPPLIER relation that belong to two different
fragments. In this case this condition is easily verified, because the supplier numbers
are unique keys of the SUPPLIER relation.
4.3.3 Vertical Fragmentation:
The Vertical fragmentation of a global relation is the subdivision of its attributes into
groups; fragments are obtained by projecting the global relation over each group.
This can be useful in distributed databases where each group of attributes can contain
data that have common geographical properties. The fragmentation is correct; if each
attribute is mapped into at least one attribute of the fragments; moreover, it must be
possible to reconstruct the original relation by joining the fragments together.
Example: Consider a global relation
EMP (EMPNUM, NAME, SAL, TAX, MGRNUM, DEPTNUM)
A vertical fragmentation of this relation can be defines as
EMP1=PJ EMPNUM,NAME, MGRNUM, DEPTNUM EMP
EMP2=PJ EMPNUM, SAL,TAX EMP
The reconstruction of relation EMP can be obtained as
EMP=EMP1JN EMPNUM=EMPNUM EMP2
This is because; EMPNUM is a key of EMP.
Let us draw some important points to be noted from this example.
The purpose of including the key of the global relation into each
fragment is to ensure the reconstruction property.
An alterative way to provide the reconstruction property is to
generate tuple identifiers that are used as system-controlled keys.
This can be convenient in order to avoid the replication of large
keys; moreover, users cannot modify tuple identifiers.
Let us finally consider the problem of fragment disjoint ness. First, we have seen that
at least the key should be replicated in all fragments in order to allow reconstruction.
In fact, if we include the same attribute in two different vertical fragments, we know
exactly that the column that corresponds to this attribute.
For example, consider the following vertical fragmentation of relation EMP:
EMP1 = PJEMPNUM,NAME,MGRNUM,DEPTNUM EMP
EMP2 = PJEMPNUM,NAME,SAL,TAX EMP
The attribute NAME is replicated in both fragments. We can remove this attribute
when we reconstruct relation EMP through an additional projection operation.
EMP = EMP1 JNEMPNUM=EMPNUM PJEMPNUM, SAL, TAX EMP2
4.3.4 Mixed Fragmentation: The fragments that are obtained by the above
fragmentation operations are relations themselves, so that it is possible to apply the
fragmentation operations recursively, provided that the correctness conditions are
satisfied each time. The reconstruction can be obtained by applying the reconstruction
rules in reverse order.
Example: Consider the same global relation
EMP (EMPNUM, NAME, SAL, TAX, MGRNUM, DEPTNUM)
The following is a mixed fragmentation, which is obtained by applying the vertical
fragmentation of the previous example, followed by a horizontal fragmentation on
DEPTNUM:
EMP1 = SLDEPTNUM10 PJEMPNUM, NAME, MGRNUM, DEPTNUM EMP
EMP2 = SL10<DEPTNUM20 PJEMPNUM, NAME, MGRNUM, DEPTNUM EMP
EMP3 = SLDEPTNUM>20 PJEMPNUM, NAME, MGRNUM, DEPTNUM EMP
EMP4 = PJEMPNUM, NAME, SAL , TAX EMP
EMP
EMP4
The EXAMPLE_DDB:
The
following
codes
shows
the
global
and
fragmentation
schemata
of