Ddbms Unit 1
Ddbms Unit 1
Management System
UNIT-1
© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Imran Khan (Asst. Prof.) U1.1
Learning Objective
• Distributed DBMS features and needs
• Reference Architecture, Levels of Distribution
• Transparency, Replication, Distributed
database design – Fragmentation, allocation
criteria,
• Storage mechanisms, Translation of Global
Queries / Global Query Optimization, Query
• Execution and access plan
© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Imran Khan(Asst. Prof.) U1.2
A Centralized DBMS on a Network
Centralized DBMSs
in which all of the
data is maintained at
a single site given as
in figure.
© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Imran Khan(Asst. Prof.) U1.3
Disadvantage of Centralized Database
Disadvantages:
• Single Point of failure
• Performance Bottleneck
• Contention- Competition for resources
It is a situation where two or more nodes
attempt to transmit a message across the
same wire at the same time, Contention
(term) is used especially in Networks
© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Imran Khan(Asst. Prof.) U1.4
Distributed Database System
A distributed
database (DDB) is
a collection of
multiple, logically
interrelated
databases
distributed over a
computer network.
© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Imran Khan(Asst. Prof.) U1.5
Distributed Database System Cont…
© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Imran Khan(Asst. Prof.) U1.6
Functions of a DDBMS
• Expect DDBMS to have at least the
functionality of a DBMS.
• Also to have following functionality:
Extended communication services.
Extended Data Dictionary.
Distributed query processing.
Extended concurrency control.
Extended recovery services.
© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Imran Khan(Asst. Prof.) U1.7
Advantages of DDBMS
1) Improved Performance - data located near
site.
2) Improved Availability - node failure will not
make system inoperable.
3) Improved Reliability - replicated data allows
data accessibility.
4)Organisational structure - many organizations
cover several sites.
5)Shareability and local autonomy - users at
different sites can share.
© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Imran Khan(Asst. Prof.) U1.8
Disadvantages of DDBMS
• Complexity- more complex than centralized
• Cost - added network and maintenance
costs
• Security - network must be made secure
• Integrity control more difficult
• Lack of standards
• Lack of experience- no tools or
methodologies
• Database design more complex
© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Imran Khan(Asst. Prof.) U1.9
Reference Architecture
• Distributed database facilitate distribution of
data across vast geographical spread.
Distributed database is a collection of various
database sites which are mapped as a single
global database.
• Some levels may be missing, depending on
levels of transparency supported.
• Can be homogeneous or heterogeneous
© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Imran Khan(Asst. Prof.) U1.10
Reference Architecture Cont…
Global schema
Fragmentation schema
Allocation schema
© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Imran Khan(Asst. Prof.) U1.11
Reference Architecture Cont…
1.Global schema defines all the data which
are contained in the distributed data base as if
the database were not distributed at all, or in
short global schema defines data as a whole.
GlobalSchema:Employee(EmpNo,Ename,Dept)
© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Imran Khan(Asst. Prof.) U1.12
Reference Architecture Cont…
relations are fragmented to serve the
purpose of distribution.
Fragmentation Schema:
Employee1=SLDept=‘Mgr’ Employee
Employee2=SLDept=‘Sales’ Employee
© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Imran Khan(Asst. Prof.) U1.13
Reference Architecture Cont…
3.Below the fragmentation schema exists the
allocation schema determining the sites on which
any particular fragment is to be deployed.
© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Imran Khan(Asst. Prof.) U1.14
Reference Architecture Cont…
• The first layer at the local database site is the
local mapping schema which helps in
identifying the global relation schema for any
local database relation schema. It is the local
mapping schema which facilitates the
integration of local database sites into one
single global database.
Integrated banking
Heterogeneous Inter-divisional and inter-banking
information
systems systems
© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Imran Khan(Asst. Prof.) U1.16
Types of DDBMS
Homogeneous – Same DBMS is used at
each site.
• Autonomous – Each DBMS works
independently, passing messages back
and forth to share data updates.
• Non-Autonomous – A central, or master,
DBMS coordinates database access and
updates across the sites.
© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Imran Khan(Asst. Prof.) U1.17
Types of DDBMS Cont…
© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Imran Khan(Asst. Prof.) U1.18
A Homogenous Distributed Database Cont…
© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Imran Khan(Asst. Prof.) U1.19
A Homogenous Distributed Database Cont…
Global
Global
user
user
Global
Distributed DBMS schema
Node 1 2 3 n
DBMS DBMS DBMS DBMS
Software Software Software Software
© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Imran Khan(Asst. Prof.) U1.20
A Heterogeneous Distributed Database Cont…
© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Imran Khan(Asst. Prof.) U1.21
Distribution Transparency
• In any distributed system transparency is the
© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Imran Khan(Asst. Prof.) U1.22
Levels of Distribution Transparency
1. Fragmentation Transparency: The user is not aware of
the existence of fragments and work on global relations.
© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Imran Khan(Asst. Prof.) U1.23
Levels of Distribution Transparency Cont…
© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Imran Khan(Asst. Prof.) U1.24
Levels of Distribution Transparency Cont…
© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Imran Khan(Asst. Prof.) U1.25
Levels of Distribution Transparency Cont…
© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Imran Khan(Asst. Prof.) U1.26
Data Replication
A relation or fragment of a relation is
replicated if it is stored redundantly in two or
more sites.
The two approach is given below:
• Full replication of a relation is the case
where the relation is stored at all sites.
• Fully redundant databases are those in
which every site contains a copy of the entire
database.
© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Imran Khan(Asst. Prof.) U1.27
Framework for Distributed Database Design
© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Imran Khan(Asst. Prof.) U1.31
Fragmentation Cont…
• Horizontal – Subset of rows
• Vertical – Subset of columns
Each fragment must contain primary key
Other columns can be replicated
• Mixed (hybrid) – both horizontal and vertical
• Derived – Derived from the horizontal
fragmentation of another relation.
© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Imran Khan(Asst. Prof.) U1.32
Fragmentation Cont…
Example:
• Natural join first to get additional
information required then fragment Must
be able to reconstruct original table Can
query and update through fragment
© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Imran Khan(Asst. Prof.) U1.33
Horizontal Fragmentation
• Horizontal fragmentation is based on the
selection operation. Some condition is
chosen and against this condition the tuples
are evaluated only those tuples which
satisfied the condition become the part of
that corresponding fragment.
• Example: If there is an organization it may
fragment its global employees relation
horizontally by keeping the records of the
employee belonging to one particular country
in a separate horizontal fragment.
© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Imran Khan(Asst. Prof.) U1.34
Horizontal Fragmentation Cont…
Condition can be
C1=country_name=“INDIA”
C2=country_name=“United States”
.
.
.
.CN=country_name=“Srilanka”
© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Imran Khan(Asst. Prof.) U1.35
Horizontal Fragmentation Cont…
Example:
Let’s a global relation (table) Supplier.
Supplier (SNum,Name,City)
Then the horizontal fragmentation can be
defined as following:
Supplier1=SL city=“sf” Supplier
Supplier2=SL city=“la” Supplier
© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Imran Khan(Asst. Prof.) U1.36
Horizontal Fragmentation Cont…
• Completeness
(The above fragmentation satisfies the
completeness condition if “sf” and “la” are the
only possible values of the City attribute ,
otherwise we would not know to which
fragment the tuples with other City Values
belong.)
© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Imran Khan(Asst. Prof.) U1.37
Horizontal Fragmentation Cont…
• Reconstruction (It is always possible to
reconstruct the Supplier global relation by using
Union operation )
Supplier=Supplier1 UN Supplier2
© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Imran Khan(Asst. Prof.) U1.38
Derived Horizontal Fragmentation
© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Imran Khan(Asst. Prof.) U1.39
Vertical Fragmentation
• It is based on Projection Operation
The Predicate of the projection operation is a
list of Attribute which are intended to
constitute that corresponding vertical
fragment.
© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Imran Khan(Asst. Prof.) U1.40
Vertical Fragmentation
• Vertical Cont…
Fragmentation
be can never
absolutely disjoint at least one column needs
to be common, so as maintains referential
integrity
© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Imran Khan(Asst. Prof.) U1.41
Vertical Fragmentation
• Consists of
Cont…
a subset of attributes (column)
of a
relation.
• Defined using Projection operation of relational
algebra:
• a1, ... ,an(R)
• For example:
• S1 = staffNo, position, sex, DOB, salary(Staff)
• S2 = staffNo, fName, lName, branchNo(Staff)
© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Imran Khan(Asst. Prof.) U1.43
Fragment Allocation
• In determining the allocation of fragments, it
is important to distinguish whether we
design a final non redundant or redundant
allocation.
© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Imran Khan(Asst. Prof.) U1.44
Fragment Allocation
In case of non redundant final allocation is
easier. The simplest method is a “best-fit”
approach; a measure is associated with each
possible allocation, and the site with the best
measure is selected.
© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Imran Khan(Asst. Prof.) U1.45
Fragment Allocation Cont…
Replication introduces further complexity in the
design, because:
© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Imran Khan(Asst. Prof.) U1.46
Fragment Allocation Cont…
• Determine the set of all sites where the “benefit of
allocating one copy of fragment is higher than the cost”,
and allocate a copy of the fragment to each element of
this set; this method select “all beneficial sites”.
© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Imran Khan(Asst. Prof.) U1.48
Fragment Allocation Cont…
Replication and fragmentation can be
combined
Relation is partitioned into several
fragments: system maintains several
identical replicas of each such fragment.
© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Imran Khan(Asst. Prof.) U1.49
Translating of Global Query
• In distributed Data base management system a
single global relation is some times fragmented
and these fragments are deployed on various
distinct sites, more over to ensure processing
locality some times a relation or a fragment
gets replicated even.
• A query on the other hand is issued by a user
or an application which is not aware of the
existence of fragments, replicas and their
respected allocations. This global query for its
successful execution must get decomposed
into fragment Queries.
© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Imran Khan(Asst. Prof.) U1.50
Translating of Global Query Cont…
A global query can be
© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Imran Khan(Asst. Prof.) U1.51
Translating of Global Query Cont…
© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Imran Khan(Asst. Prof.) U1.52
Translating of Global Query Cont…
• The above fragment Queries are than
executed at the respective sites and the
result of these Queries are combine using a
union operation and the result is to initiator
site.
© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Imran Khan(Asst. Prof.) U1.54
Catalog Management
Catalog Management OR Distribute Data
Dictionary Management
© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Imran Khan(Asst. Prof.) U1.55
Approaches for Catalog Management
• Centralized Approach
• Distributed Approach.
© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Imran Khan(Asst. Prof.) U1.56
Centralized Approach for catalog Management.
• Under this approach the system catalog is
maintained at one of the participating sites in the
distributed database.
© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Imran Khan(Asst. Prof.) U1.57
Centralized Approach Cont…
In case the coordinator site fails no site could
Progress as the catalog is maintain at only one
place and added to that Query processing for all
the sides can only be as efficient as the
coordinator site is.
© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Imran Khan(Asst. Prof.) U1.58
Distributed Approach for catalog Management.
© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Imran Khan(Asst. Prof.) U1.59
Full Replication Approach
Under this approach the complete catalog is
maintained on all the sites this allows
processing locality to all the sites in a manner
that the system catalog being locally available
each site has a greater degree of Autonomy.
© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Imran Khan(Asst. Prof.) U1.60
Draw Backs
Draw Backs
BUT this approach has its own set of Draw
backs. One of the draw back is the storage
overhead owing to greater redundancy and
the other draw back is the consistency
problem that is how to keep the replicated
copies of the system catalog on various sites
synchronized.
© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Imran Khan(Asst. Prof.) U1.61
Partial Replication Approach
• Under this approach each site maintains a
local catalog where information about the data
base objects for which the corresponding site
is the birth site is store.
© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Imran Khan(Asst. Prof.) U1.62
Partial Replication Approach Cont…
When ever any site submits a Query if it can
be handled using the local catalog its OK
else the links are evaluated. If the information
is not available in the set of links than hunt
for the data base object is made and the set
of links is accordingly updated.
© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Imran Khan(Asst. Prof.) U1.63
Query Optimization
© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Imran Khan(Asst. Prof.) U1.64
Query Optimization Cont…
Find
Findall
allcourses
coursesthat
that“Mary”
“Mary”takes
takes
SELECT
SELECT C.name
C.name
FROM
FROM Students
Students S,
S, Takes
Takes T,
T, Courses
Courses CC
WHERE
WHERE S.name=“Mary”
S.name=“Mary” and and
S.ssn
S.ssn == T.ssn
T.ssn and
and T.cid
T.cid == C.cid
C.cid
© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Imran Khan(Asst. Prof.) U1.65
Query Optimization Cont…
SELECT
SELECT C.name
C.name
FROM
FROMStudents
StudentsS,
S,Takes
TakesT,
T,Courses
CoursesCC
WHERE
WHERES.name=“Mary”
S.name=“Mary”andand cid=cid
S.ssn
S.ssn==T.ssn
T.ssnand
andT.cid
T.cid==C.cid
C.cid
sid=sid
name=“Mary”
© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Imran Khan(Asst. Prof.) U1.67
Query Optimization Cont…
• Operator/Query Tree provides a more practical
representation of queries, in which expression
manipulation is easier.
PJsnum
SLArea=‘North’
JN deptnum=deptnum
Supply Dept
© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Imran Khan(Asst. Prof.) U1.69
Query Optimization Cont…
PJsnum
Case2-Fragments
SLArea=‘North’
JN deptnum=deptnum
UN UN
© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Imran Khan(Asst. Prof.) U1.70
Query Optimization Cont…
PJsnum
Case3-Fragments with
Optimized result.
JN deptnum=deptnum
UN UN
SLArea=‘North SLArea=‘North
’ ’
SLArea=‘North
Supply1 Supply2 Supply N Dept1’ Dept2 Dept N
© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Imran Khan(Asst. Prof.) U1.71
Execution and Access Plan
• In order to execute and access query a plan
is prepared by the programmer.
2) At sites 2 and 3
Execute in parallel, upon receipt of the supplier number,
the following program:
3) At site 1
Merge results from sites 2 and 3;
Output the result.
© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Imran Khan(Asst. Prof.) U1.74
Short Questions
• Explain the use of distributed DBMS over
Centralized DBMS?
• Discuss the transparency in terms of
transaction.
• Describe various fragmentation techniques
with examples?
• Explain the distribution of a Database on
various sites.
• What is distributed DBMS and write its
features?
© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Imran Khan(Asst. Prof.) U1.75
Long Questions
• What are Global Optimization, Execution and
Access Plan, give an example for access plan?
• Differentiate between homogeneous and
heterogeneous DDBMS?
• Advantage and disadvantage of DDBMS,
Explain?
• Describe Distributed approach for catalog
management?
• What is fragmentation explain different type of
fragmentation?
© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Imran Khan(Asst. Prof.) U1.76
References
1. S. Ceri, G. Pelagatti, “Distributed Database: Principles
and Systems”, McGraw Hill, New York, 1985.
2. M. Tamer Ozsu, Patrick Valduriez, “Principles of
Distributed Databases System”, Pearson, 2nd Ed.,
2009.
3. Mario Piattini, “Advanced Database Technology and
Design”, Artech House, UK, 2000.
4. Shivendra Goel, Divya Goel, “ Distributed Database
Management System”, Sun India Publications, 2009.
5. Chhanda Ray, “Distributed Database System”,
Pearson, 2009.
© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Imran Khan(Asst. Prof.) U1.77