Distributed Database System: By: Madiha Hameed
Distributed Database System: By: Madiha Hameed
System
Ch.1/1
Outline
• Introduction
• Background
• Distributed Database Design
• Database Integration
• Semantic Data Control
• Distributed Query Processing
• Multidatabase Query Processing
➡ Query Rewriting
➡ Optimization Issues
Ch.1/3
Mediator/Wrapper Architecture
Mediator
Same Different
Interface Interfaces
Query
Processing Local
Wrapper1 DBMS1
Schema
Ch.1/4
Advantages of M/W Architecture
• Wrappers encapsulate the details of component DBMS
• Export schema and cost information
• Manage communication with Mediator
Ch.1/5
Issues in MDB Query Processing
• Component DBMSs are autonomous and may range from full-
fledge relational DBMS to flat file systems
• Different computing capabilities
• Prevents uniform treatment of queries across DBMSs
• Different processing cost and optimization capabilities
• Makes cost modeling difficult
• Different data models and query languages
• Makes query translation and result integration difficult
• Different runtime performance and unpredictable behavior
• Makes query execution difficult
Ch.1/6
Component DBMS Autonomy
• Communication autonomy
• The ability to terminate services at any time
• How to answer queries completely?
• Design autonomy
• The ability to restrict the availability and accuracy of information needed
for query optimization
• How to obtain cost information?
• Execution autonomy
• The ability to execute queries in unpredictable ways
• How to adapt to this?
Ch.1/7
Mediator Data Model
• Relational model
• Simple and regular data structures
• Mandatory schema
• Object model
• Complex (graphs) and regular data structures
• Mandatory schema
Ch.1/8
MDB Query Processing
Architecture
Global/local
correspondences
Allocation and
capabilities
Local/DBMS
mappings
Ch.1/9
Query Rewriting Using Views
• Views used to describe the correspondences between global and
local relations
• Global As View: the global schema is integrated from the local databases
and each global relation is a view over the local relations
• Local As View: the global schema is defined independently of the local
databases and each local relation is a view over the global relations
• Query rewriting best done with Datalog, a logic-based language
• More expressive power than relational calculus
• Inline version of relational domain calculus
Ch.1/10
Datalog Terminology
• Conjunctive (SPJ) query: a rule of the form
• Q(T) :- R1(T1), … Rn(Tn)
• Q(T) : head of the query denoting the result relation
• R (T ), … R (T ): subgoals in the body of the query
1 1 n n
• R , … R : predicate names corresponding to relation names
1 n
• T , … T : refer to tuples with variables and constants
1 n
• Variables correspond to attributes (as in domain calculus)
• “-” means unnamed variable
Ch.1/11
Datalog Example
With EMP(ENAME,TITLE,CITY) and ASG(ENAME,PNAME,DUR)
Q(ename,title,pname) :- Emp(ename,title,-)
Asg(ename,pname,-),
title = “Programmer”.
Q(ename,title,pname) :- Emp(ename,title,-)
Asg(ename,pname,24).
Ch.1/12
Question ?
13
Ch.1/13