Distributed Database Management System UNIT-1 -...

29
MCA 325, Distributed DBMS And Object Oriented Databases © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel U1.1 Distributed Database Management System © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.1 UNIT-1 Distributed DBMS features and needs Reference Architecture, Levels of Distribution Transparency, Replication, Distributed database design – Fragmentation, allocation criteria Learning Objective © Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.2 criteria, Storage mechanisms, Translation of Global Queries / Global Query Optimization, Query Execution and access plan 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 Shivendra Goel. U1.3

Transcript of Distributed Database Management System UNIT-1 -...

Page 1: Distributed Database Management System UNIT-1 - …bvicam.in/sites/default/files/subject/LearningMannuals/DDBMS UNIT-1...U1.1 UNIT-1 • Distributed DBMS features and needs • Reference

MCA 325, Distributed DBMS And Object Oriented Databases

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel U1.1

Distributed Database Management System

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.1

UNIT-1

• Distributed DBMS features and needs

• Reference Architecture, Levels of Distribution

• Transparency, Replication, Distributed database design – Fragmentation, allocation criteria

Learning Objective

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.2

criteria,

• Storage mechanisms, Translation of Global Queries / Global Query Optimization, Query

• Execution and access plan

A Centralized DBMS on a Network

Centralized DBMSsin which all of thedata is maintained ata single site given asin figure.

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.3

Page 2: Distributed Database Management System UNIT-1 - …bvicam.in/sites/default/files/subject/LearningMannuals/DDBMS UNIT-1...U1.1 UNIT-1 • Distributed DBMS features and needs • Reference

MCA 325, Distributed DBMS And Object Oriented Databases

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel U1.2

Disadvantages:

• Single Point of failure

• Performance Bottleneck

• Contention- Competition for resources

Disadvantage of Centralized Database

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.4

It is a situation where two or more nodesattempt to transmit a message across thesame wire at the same time, Contention(term) is used especially in Networks

• In a distributed database system, data isphysically stored across several sites, andeach site is typically managed by a DBMScapable of running independent of theother sites.

Distributed Database System

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.5

• The location of the data items and thedegree of autonomy of the individual siteshave a significant impact on all aspects ofthe system, including query processingand optimization, concurrency control, andrecovery.

• In contrast to parallel database systems, thedistribution of data is governed by factorssuch as local ownership and increasedavailability, in addition to performance relatedissues.

Distributed Database System Cont…

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.6

Page 3: Distributed Database Management System UNIT-1 - …bvicam.in/sites/default/files/subject/LearningMannuals/DDBMS UNIT-1...U1.1 UNIT-1 • Distributed DBMS features and needs • Reference

MCA 325, Distributed DBMS And Object Oriented Databases

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel U1.3

A distributed database (DDB) is a collection of multiple, logically interrelated databases distributed over a

Distributed Database System Cont…

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.7

computer network.

• Distributed Database - A logicallyinterrelated collection of shared data (and adescription of this data), physicallydistributed over a computer network.

Distributed Database System Cont…

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.8

• DDBMS - Software system that permits themanagement of the distributed databaseand makes the distribution transparent tousers.

• Processing logic- Processing logic/Processing elements are distributed-Inventory-Personnel-Sales

• Functions

Distributed Database System Cont…

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.9

• FunctionsFunctions of a system could be delegated tovarious pieces of hardware/ software-Printing-Email

Page 4: Distributed Database Management System UNIT-1 - …bvicam.in/sites/default/files/subject/LearningMannuals/DDBMS UNIT-1...U1.1 UNIT-1 • Distributed DBMS features and needs • Reference

MCA 325, Distributed DBMS And Object Oriented Databases

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel U1.4

• Data

Data used by a no. of applications may bedistributed to a no. processing sites.

C t l

Distributed Database System Cont…

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.10

• Control

• Centralized Vs Hierarchical ControlSite Autonomy

• Data Independence Vs Distribution TransparencyA t l O i ti f d t i t t t

Features of Centralized Vs distributed Databases

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.11

Actual Organization of data is transparent to the application programmer

• Reduced Redundancy Vs RedundancyIncreased locality of Applications Site Failure

• Indexing, Chaining Vs Distributed Access Plan

The Execution of programs which are local at single site and the transmission of files between sites

Features of Centralized Vs distributed Databases

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.12

between sites.

Page 5: Distributed Database Management System UNIT-1 - …bvicam.in/sites/default/files/subject/LearningMannuals/DDBMS UNIT-1...U1.1 UNIT-1 • Distributed DBMS features and needs • Reference

MCA 325, Distributed DBMS And Object Oriented Databases

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel U1.5

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

Advantages of DDBMS

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.13

data accessibility.4)Organisational structure - many organizations

cover several sites.5)Shareability and local autonomy - users at

different sites can share.

Business Advantages

1) Economics

Several smaller computer may be cheaperthan a Mainframe system

2) M d l G th i i

Business Advantages

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.14

2) Modular Growth-easier expansion

3) Integration

Allows for combining of several legacydatabases into one DBMS.

• Complexity- more complex than centralized

• Cost - added network and maintenancecosts

• Security - network must be made secure

Disadvantages of DDBMS

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.15

• Integrity control more difficult

• Lack of standards

• Lack of experience- no tools ormethodologies

• Database design more complex

Page 6: Distributed Database Management System UNIT-1 - …bvicam.in/sites/default/files/subject/LearningMannuals/DDBMS UNIT-1...U1.1 UNIT-1 • Distributed DBMS features and needs • Reference

MCA 325, Distributed DBMS And Object Oriented Databases

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel U1.6

• Distributed database facilitate distribution ofdata across vast geographical spread.Distributed database is a collection of variousdatabase sites which are mapped as a singleglobal database.

Reference Architecture

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.16

g

• Some levels may be missing, depending onlevels of transparency supported.

• Can be homogeneous or heterogeneous

Global schema

Fragmentation schema

Allocation schema

Reference Architecture Cont…

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.17

Local mapping schema Local mapping schema Local mapping schema

Local schema Local schema Local schema

DB site 2 DB site NDB site 1

1.Global schema defines all the data whichare contained in the distributed data base as ifthe database were not distributed at all, or inshort global schema defines data as a whole.

Reference Architecture Cont…

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.18

GlobalSchema:Employee(EmpNo,Ename,Dept)

2.The Next layer is the Fragmentation Schema specifying the way in which the global

Page 7: Distributed Database Management System UNIT-1 - …bvicam.in/sites/default/files/subject/LearningMannuals/DDBMS UNIT-1...U1.1 UNIT-1 • Distributed DBMS features and needs • Reference

MCA 325, Distributed DBMS And Object Oriented Databases

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel U1.7

relations are fragmented to serve the purpose of distribution.

Fragmentation Schema: Employee1=SLDept=‘Mgr’ Employee

Reference Architecture Cont…

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.19

p y p g p y

Employee2=SLDept=‘Sales’ Employee

3.Below the fragmentation schema exists theallocation schema determining the sites onwhich any particular fragment is to be

deployed.

Reference Architecture Cont…

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.20

Allocation Schema: Employee1 at site1,2

Employee2 at site3,4

4.The subsequent layers exists on the local data base sites.

• The first layer at the local database site is thelocal mapping schema which helps inidentifying the global relation schema for anylocal database relation schema. It is the localmapping schema which facilitates theintegration of local database sites into one

Reference Architecture Cont…

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.21

gsingle global database.

• Below this layer is the local schema of thelocal DBMS. It is very much similar to thethree schema architecture of the centralizeddata bases.

Page 8: Distributed Database Management System UNIT-1 - …bvicam.in/sites/default/files/subject/LearningMannuals/DDBMS UNIT-1...U1.1 UNIT-1 • Distributed DBMS features and needs • Reference

MCA 325, Distributed DBMS And Object Oriented Databases

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel U1.8

• Homogeneous - All servers use same DBMS

• Heterogeneous – All servers use different DBMS

Examples of typical applications:

Type of DBMS LAN network WAN network

Classification of DDBMS

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.22

WAN network

HomogenousData management and financial applications

Travel management and financial applications

Heterogeneous Inter-divisional information systems

Integrated banking and inter-banking systems

Homogeneous – Same DBMS is used ateach site.

• Autonomous – Each DBMS worksindependently, passing messages backand forth to share data updates.

Types of DDBMS

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.23

• Non-Autonomous – A central, or master,DBMS coordinates database access andupdates across the sites.

Heterogeneous – Potentially different DBMSsare used at each site.

• Systems – support some or all of thefunctionality of one logical database.

Types of DDBMS Cont…

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.24

• Full DBMS functionality – supports all ofthe functionality of a distributeddatabase.

Page 9: Distributed Database Management System UNIT-1 - …bvicam.in/sites/default/files/subject/LearningMannuals/DDBMS UNIT-1...U1.1 UNIT-1 • Distributed DBMS features and needs • Reference

MCA 325, Distributed DBMS And Object Oriented Databases

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel U1.9

• A typical homogeneous distributeddatabase environment is illustrated on thefollowing page.

• This environment is typically defined by thefollowing characteristics:

A Homogenous Distributed Database

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.25

following characteristics:

• Data are distributed across all the nodes.

• The same DBMS is used at eachlocation.

• All data are managed by the distributedDBMS. There is no exclusively local data.

• All users access the database through oneglobal schema or database definition.

A Homogenous Distributed Database Cont…

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.26

• The global schema is simply the union ofall the local database schemas.

Distributed DBMS

Globalschema

Global user

Global user

A Homogenous Distributed Database Cont…

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.27

Node

DBMSSoftware

1

DBMSSoftware

DBMSSoftware

DBMSSoftware

2 3 n

Page 10: Distributed Database Management System UNIT-1 - …bvicam.in/sites/default/files/subject/LearningMannuals/DDBMS UNIT-1...U1.1 UNIT-1 • Distributed DBMS features and needs • Reference

MCA 325, Distributed DBMS And Object Oriented Databases

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel U1.10

• It is difficult in most organizations to forcea homogeneous environment, yetheterogeneous environments are muchmore difficult to manage.

A Homogenous Distributed Database Cont…

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.28

• As the diagram illustrates, there are manyvariations of heterogeneous distributeddatabase environments, however; atypical heterogeneous distributeddatabase environment is defined by thefollowing characteristics:

• Data are distributed across all the nodes.

• Different DBMSs may used at eachlocation.

• Some users require only local access to

A Homogenous Distributed Database Cont…

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.29

databases, which can be accomplishedusing only the local DBMS and schema.

• A global schema exists, which allows localusers to access “remote data”.

• In any distributed system transparency is the

most central issue.

• Base of distributed data base management

system (DDBMS) emphasis‘s that a DDBMS

Distribution Transparency

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.30

should work like a non-Distributed DBMS.

• The rule thus insists that the user should not

be aware of the distribution of data.

Page 11: Distributed Database Management System UNIT-1 - …bvicam.in/sites/default/files/subject/LearningMannuals/DDBMS UNIT-1...U1.1 UNIT-1 • Distributed DBMS features and needs • Reference

MCA 325, Distributed DBMS And Object Oriented Databases

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel U1.11

1. Fragmentation Transparency: The user is not aware of the existence of fragments and work on global relations.

Update emp set empno=10 where deptno=15; (level1)

Levels of Distribution Transparency

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.31

deptno=15; (level1)

2.Location Transparency: The user is aware of the fragments but it is not aware of the site of which they have been deployed.

Insert into emp1 values(1,’Amit’,20);

Insert into emp2 values(2,’Ajeet’,30);

Delete emp1 where empno=10;

Delete emp2 where empno=10; (level2)

Levels of Distribution Transparency Cont…

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.32

3. Local Mapping Transparency: The user isaware of the fragments and the sites onwhich they have been deployed BUT he isinsulated from the heterogeneity aspects.

emp1: site1 and site 5(In case of update

Levels of Distribution Transparency Cont…

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.33

emp1: site1 and site 5(In case of updateoperation (replication))emp2: site2 and site 6emp3: site3 and site 7emp4: site4 and site 8

Page 12: Distributed Database Management System UNIT-1 - …bvicam.in/sites/default/files/subject/LearningMannuals/DDBMS UNIT-1...U1.1 UNIT-1 • Distributed DBMS features and needs • Reference

MCA 325, Distributed DBMS And Object Oriented Databases

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel U1.12

Selecte name,esal,etax into $ename,$esal,$etax from emp1 at site1 where empno.=10;

• Insert into emp3(empno,ename,deptno) atsite 3: (10 $ename 15);

Levels of Distribution Transparency Cont…

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.34

site 3: (10,$ename,15);

• Insert into emp3(empno,ename,deptno) atsite 7: (10,$ename,15);

• Insert into emp4(empno,esal,etax) at site 4:(10,$esal,$tax);

A relation or fragment of a relation isreplicated if it is stored redundantly in two ormore sites.

The two approach is given below:

Data Replication

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.35

• Full replication of a relation is the casewhere the relation is stored at all sites.

• Fully redundant databases are those inwhich every site contains a copy of the entiredatabase.

Framework for Distributed Database Design

•Designing the conceptual schema- Whichdescribes the integrated database. (i.e., all thedata which are used by the databaseapplications)

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.36

•Designing the physical database (i.e.,mapping the conceptual schema to storageareas and determining appropriate accessmethods)

•Designing the fragmentation

•Designing the allocation of fragments

Page 13: Distributed Database Management System UNIT-1 - …bvicam.in/sites/default/files/subject/LearningMannuals/DDBMS UNIT-1...U1.1 UNIT-1 • Distributed DBMS features and needs • Reference

MCA 325, Distributed DBMS And Object Oriented Databases

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel U1.13

Objectives of data distribution design

•Processing locality - It ensures that thoseunits of data which are most frequentlyaccessed by any site are maintained locally asfar as possible.

A il bilit A hi h d f il bilit f

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.37

•Availability - A high degree of availability forread only applications is achieved by storingmultiple copies of the same information; thesystem must be able to switch to an alternativecopy when the one that should be accessedunder normal condition is not available.

• Reliability-Reliability is also achieved by storing multiple copies of the same information, since it is possible to recover from the crashes or from the physical destruction.

Objectives of data distribution design Cont…

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.38

• Distribution of workload- Workload distribution is done in order to take advantage of the different powers or utilizations of computers at each site.

• Storage costs- Storage cost is directly depend on the how much information is locally required.

• Fragmentation is the process ofdecomposition of global relations intofragments.

Types of Fragmentation:

Fragmentation

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.39

• Horizontal Fragmentation

• Derived horizontal Fragmentation

• Vertical Fragmentation

• Hybrid/Mixed

Page 14: Distributed Database Management System UNIT-1 - …bvicam.in/sites/default/files/subject/LearningMannuals/DDBMS UNIT-1...U1.1 UNIT-1 • Distributed DBMS features and needs • Reference

MCA 325, Distributed DBMS And Object Oriented Databases

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel U1.14

• Horizontal – Subset of rows• Vertical – Subset of columns

Each fragment must contain primary keyOther columns can be replicated

• Mixed (hybrid) both horizontal and vertical

Fragmentation Cont…

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.40

• Mixed (hybrid) – both horizontal and vertical• Derived – Derived from the horizontal

fragmentation of another relation.

Example:

• Natural join first to get additionalinformation required then fragment Mustbe able to reconstruct original table Can

Fragmentation Cont…

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.41

query and update through fragment

• Horizontal fragmentation is based on theselection operation. Some condition ischosen and against this condition the tuplesare evaluated only those tuples whichsatisfied the condition become the part ofthat corresponding fragment

Horizontal Fragmentation

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.42

that corresponding fragment.• Example: If there is an organization it may

fragment its global employees relationhorizontally by keeping the records of theemployee belonging to one particular countryin a separate horizontal fragment.

Page 15: Distributed Database Management System UNIT-1 - …bvicam.in/sites/default/files/subject/LearningMannuals/DDBMS UNIT-1...U1.1 UNIT-1 • Distributed DBMS features and needs • Reference

MCA 325, Distributed DBMS And Object Oriented Databases

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel U1.15

Condition can be

C1=country_name=“INDIA”

C2=country_name=“United States”

.

.

Horizontal Fragmentation Cont…

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.43

.

.

.CN=country_name=“Srilanka”

Example:Let’s a global relation (table) Supplier.Supplier (SNum,Name,City)

Then the horizontal fragmentation can bedefined as following:

Horizontal Fragmentation Cont…

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.44

defined as following:Supplier1=SL city=“sf” SupplierSupplier2=SL city=“la” Supplier

• Completeness

(The above fragmentation satisfies thecompleteness condition if “sf” and “la” are theonly possible values of the City attribute ,otherwise we would not know to which

Horizontal Fragmentation Cont…

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.45

otherwise we would not know to whichfragment the tuples with other City Valuesbelong.)

Page 16: Distributed Database Management System UNIT-1 - …bvicam.in/sites/default/files/subject/LearningMannuals/DDBMS UNIT-1...U1.1 UNIT-1 • Distributed DBMS features and needs • Reference

MCA 325, Distributed DBMS And Object Oriented Databases

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel U1.16

• Reconstruction (It is always possible to reconstruct the Supplier global relation by using Union operation )

Supplier=Supplier1 UN Supplier2

Horizontal Fragmentation Cont…

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.46

• Disjointness (Call the predicate which is used in the selection operation which define a fragment’s qualification and qualification be mutually exclusive)

Q1=City=“sf”

Q2=City=“la”

• A Derived Horizontal fragmentation is basedon conditions which are built on the outputof some other Query. The Horizontalfragment thus define is a derived horizontalfragment

Derived Horizontal Fragmentation

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.47

fragment.

• It is based on Projection OperationThe Predicate of the projection operation is alist of Attribute which are intended toconstitute that corresponding verticalfragment.

Vertical Fragmentation

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.48

• The Various predicate to carry out a verticalfragmentation are selected so as to meet theobjectives of disjointness, completenessand reconstruction.

Page 17: Distributed Database Management System UNIT-1 - …bvicam.in/sites/default/files/subject/LearningMannuals/DDBMS UNIT-1...U1.1 UNIT-1 • Distributed DBMS features and needs • Reference

MCA 325, Distributed DBMS And Object Oriented Databases

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel U1.17

• Vertical Fragmentation can never beabsolutely disjoint at least one column needsto be common, so as maintains referentialintegrity

Vertical Fragmentation Cont…

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.49

• Consists of a subset of attributes (column) of arelation.

• Defined using Projection operation of relationalalgebra:

• a1, ... ,an(R)

Vertical Fragmentation Cont…

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.50

, ,

• For example:

• S1 = staffNo, position, sex, DOB, salary(Staff)

• S2 = staffNo, fName, lName, branchNo(Staff)

• Determined by establishing affinity of oneattribute to another.

•Applying vertical fragmentation to horizontal fragmentation

Hybrid Fragmentation

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.51

Page 18: Distributed Database Management System UNIT-1 - …bvicam.in/sites/default/files/subject/LearningMannuals/DDBMS UNIT-1...U1.1 UNIT-1 • Distributed DBMS features and needs • Reference

MCA 325, Distributed DBMS And Object Oriented Databases

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel U1.18

• In determining the allocation of fragments, itis important to distinguish whether wedesign a final non redundant or redundantallocation.

Fragment Allocation

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.52

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.

Fragment Allocation

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.53

Fragment Allocation Cont…

Replication introduces further complexity in the design, because:

1. Degree of Replication is one Problem2 M i i i C i i h i

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.54

2. Maintaining Consistency is another issue.

For determining the redundant allocation offragments, either of the following two methods canbe used:

Page 19: Distributed Database Management System UNIT-1 - …bvicam.in/sites/default/files/subject/LearningMannuals/DDBMS UNIT-1...U1.1 UNIT-1 • Distributed DBMS features and needs • Reference

MCA 325, Distributed DBMS And Object Oriented Databases

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel U1.19

• 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”.

Fragment Allocation Cont…

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.55

• Determine first the solution of the nonreplicated problem, and then progressivelyintroduce replicated copies starting from themost beneficial; the process is terminatedwhen no “additional replication” is beneficial.

Assume relational data model

• Replication

System maintains multiple copies of data, stored in different sites, for faster retrieval

Fragment Allocation Cont…

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.56

and fault tolerance.

• Fragmentation

• Relation is partitioned into several fragments stored in distinct sites

Replication and fragmentation can be combined

Relation is partitioned into several fragments: system maintains several identical replicas of each such fragment

Fragment Allocation Cont…

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.57

identical replicas of each such fragment.

Page 20: Distributed Database Management System UNIT-1 - …bvicam.in/sites/default/files/subject/LearningMannuals/DDBMS UNIT-1...U1.1 UNIT-1 • Distributed DBMS features and needs • Reference

MCA 325, Distributed DBMS And Object Oriented Databases

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel U1.20

• In distributed Data base management systema single global relation is some timesfragmented and these fragments are deployedon various distinct sites, more over to ensureprocessing locality some times a relation or afragment gets replicated even

Translating of Global Query

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.58

fragment gets replicated even.• A query on the other hand is issued by a user

or an application which is not aware of theexistence of fragments, replicas and theirrespected allocations. This global query for itssuccessful execution must get decomposedinto fragment Queries.

A global query can be

Select * from student;

This Query must be decomposed into certainQ i hi h t k th i d th

Translating of Global Query Cont…

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.59

Queries which take as their operands thefragments into which student relation hasbeen fragmented. These Queries are termedas fragment queries

Select * from student1;

Select * from student2;

Select * from student3;

Translating of Global Query Cont…

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.60

.

.

.

Select * from studentN;

Page 21: Distributed Database Management System UNIT-1 - …bvicam.in/sites/default/files/subject/LearningMannuals/DDBMS UNIT-1...U1.1 UNIT-1 • Distributed DBMS features and needs • Reference

MCA 325, Distributed DBMS And Object Oriented Databases

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel U1.21

• The above fragment Queries are thanexecuted at the respective sites and theresult of these Queries are combine using aunion operation and the result is to initiatorsite.

Translating of Global Query Cont…

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.61

• For the execution of these fragments Queryit is imperative that the information aboutthe fragmentation, replication, andallocation must be obtained. Thisinformation can be derived from thefragmentation and the allocation schemaand is kept in the system catalog.

To Decompose a global Queries intofragment Queries this information is procuredfrom the catalog.

Translating of Global Query Cont…

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.62

Catalog Management OR Distribute Data Dictionary Management

System catalog Constitutes the datadictionary It is the meta data i e it holds

Catalog Management

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.63

dictionary. It is the meta data i.e. it holdsdata about data.

Page 22: Distributed Database Management System UNIT-1 - …bvicam.in/sites/default/files/subject/LearningMannuals/DDBMS UNIT-1...U1.1 UNIT-1 • Distributed DBMS features and needs • Reference

MCA 325, Distributed DBMS And Object Oriented Databases

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel U1.22

• Centralized Approach

• Distributed Approach.

Approaches for Catalog Management

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.64

• Under this approach the system catalog ismaintained at one of the participating sites in thedistributed database.

• This site the acts as the central coordinator of thedistributed data base management system.

Centralized Approach for catalog Management.

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.65

• The basic advantage of this approach is that it issimple and consistency is not a concern. BUT theapproach suffers from a major draw back1) A single Point of failure2) A performance bottle neck.

In case the coordinator site fails no site couldProgress as the catalog is maintain at only oneplace and added to that Query processing for allthe sides can only be as efficient as thecoordinator site is.

Centralized Approach Cont…

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.66

Page 23: Distributed Database Management System UNIT-1 - …bvicam.in/sites/default/files/subject/LearningMannuals/DDBMS UNIT-1...U1.1 UNIT-1 • Distributed DBMS features and needs • Reference

MCA 325, Distributed DBMS And Object Oriented Databases

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel U1.23

• Full replication Approach

• Partial replication Approach

Distributed Approach for catalog Management.

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.67

• Partial replication Approach

Under this approach the complete catalog ismaintained on all the sites this allowsprocessing locality to all the sites in a mannerthat the system catalog being locally availableeach site has a greater degree of Autonomy.

Full Replication Approach

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.68

Draw Backs

BUT this approach has its own set of Drawbacks. One of the draw back is the storageoverhead owing to greater redundancy andthe other draw back is the consistency

Draw Backs

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.69

the other draw back is the consistencyproblem that is how to keep the replicatedcopies of the system catalog on various sitessynchronized.

Page 24: Distributed Database Management System UNIT-1 - …bvicam.in/sites/default/files/subject/LearningMannuals/DDBMS UNIT-1...U1.1 UNIT-1 • Distributed DBMS features and needs • Reference

MCA 325, Distributed DBMS And Object Oriented Databases

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel U1.24

• Under this approach each site maintains alocal catalog where information about the database objects for which the corresponding siteis the birth site is store.

Partial Replication Approach

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.70

• Additionally it also holds the information of thereplicas and each site maintains a set of linksto data base objects on the other site.

When ever any site submits a Query if it canbe handled using the local catalog its OKelse the links are evaluated. If the informationis not available in the set of links than huntfor the data base object is made and the set

Partial Replication Approach Cont…

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.71

jof links is accordingly updated.

Global Query Optimization, Query

Execution and access plan

Query Optimization

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.72

p

Page 25: Distributed Database Management System UNIT-1 - …bvicam.in/sites/default/files/subject/LearningMannuals/DDBMS UNIT-1...U1.1 UNIT-1 • Distributed DBMS features and needs • Reference

MCA 325, Distributed DBMS And Object Oriented Databases

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel U1.25

Find all courses that “Mary” takes

SELECT C.nameFROM Students S, Takes T, Courses CWHERE S.name=“Mary” and

S.ssn = T.ssn and T.cid = C.cid

Query Optimization Cont…

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.73

What happens behind the scene ?• Query processor figures out how to answer

the query efficiently.

Imperative query execution plan:

SELECT C.nameFROM Students S, Takes T, Courses CWHERE S.name=“Mary” and

Declarative SQL query

sname

cid=cid

Query Optimization Cont…

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.74

WHERE S.name Mary and S.ssn = T.ssn and T.cid = C.cid

Students Takes

sid=sid

name=“Mary”

Courses

The optimizer chooses the best execution plan for a query

• Preprocess the relation or table.

• Perform selection as early as possible

• Compute common expression only once.

• Translate an expression involving a

Query Optimization Cont…

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.75

Cartesian

• Product followed by a subsequent selection into natural join.

Page 26: Distributed Database Management System UNIT-1 - …bvicam.in/sites/default/files/subject/LearningMannuals/DDBMS UNIT-1...U1.1 UNIT-1 • Distributed DBMS features and needs • Reference

MCA 325, Distributed DBMS And Object Oriented Databases

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel U1.26

• Operator/Query Tree provides a more practicalrepresentation of queries, in which expressionmanipulation is easier.

• The leaves of the tree represents the relations and

Query Optimization Cont…

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.76

• The leaves of the tree represents the relations andthat each node represents a operation.

• Example: select snum from supply,dept wheresupply. deptnum=dept.deptnum andarea=‘North’;

Operator Tree Representation

Case1-Global Relation

PJsnum

Query Optimization Cont…

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.77

SLArea=‘North’

JN deptnum=deptnum

Supply Dept

PJsnum

PJsnum

Case2-FragmentsSLArea=‘North’

JN deptnum=deptnum

Query Optimization Cont…

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.78

UN UN

Supply1 Supply2 Supply N Dept2Dept1 Dept N

Page 27: Distributed Database Management System UNIT-1 - …bvicam.in/sites/default/files/subject/LearningMannuals/DDBMS UNIT-1...U1.1 UNIT-1 • Distributed DBMS features and needs • Reference

MCA 325, Distributed DBMS And Object Oriented Databases

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel U1.27

PJsnum

Case3-Fragments with

Optimized result.

JN deptnum=deptnum

Query Optimization Cont…

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.79

UN UN

Supply1 Supply2 Supply N Dept2Dept1 Dept N

SLArea=‘North’ SLArea=‘North

SLArea=‘North’

• In order to execute and access query a planis prepared by the programmer.

• This plan determines how to navigate in thecomplete data base as well as how the data

Execution and Access Plan

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.80

complete data base as well as how the database must be accessed.

• In order to implement these plan, thisrequires to implement optimization both atglobal as well as locally.

•Global Optimization consists of determining which data must be accessed at which sites and which data files must consequently be transmitted between sites.

Global Optimization

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.81

•The main optimization parameter for global optimization is communication cost.While Local Optimization consists of deciding how to perform the local database accesses at each site.

Page 28: Distributed Database Management System UNIT-1 - …bvicam.in/sites/default/files/subject/LearningMannuals/DDBMS UNIT-1...U1.1 UNIT-1 • Distributed DBMS features and needs • Reference

MCA 325, Distributed DBMS And Object Oriented Databases

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel U1.28

At site 1

Send site 2 and 3 the supplier number SN

2) At sites 2 and 3Execute in parallel, upon receipt of the supplier number, the following program:

Example of Access plan

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.82

the following program:

Select part_no where supp_no=SN;Send result to site 1

3) At site 1Merge results from sites 2 and 3;Output the result.

Short Questions

• Explain the use of distributed DBMS over Centralized DBMS?

• Discuss the transparency in terms of transaction.

• Describe various fragmentation techniques

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.83

• Describe various fragmentation techniques with examples?

• Explain the distribution of a Database on various sites.

• What is distributed DBMS and write its features?

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,

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.84

Advantage and disadvantage of DDBMS, Explain?

• Describe Distributed approach for catalog management?

• What is fragmentation explain different type of fragmentation?

Page 29: Distributed Database Management System UNIT-1 - …bvicam.in/sites/default/files/subject/LearningMannuals/DDBMS UNIT-1...U1.1 UNIT-1 • Distributed DBMS features and needs • Reference

MCA 325, Distributed DBMS And Object Oriented Databases

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel U1.29

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

© Bharati Vidyapeeth’s Institute of Computer Applications and Management, New Delhi-63, by Shivendra Goel. U1.85

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.