SlideShare a Scribd company logo
2
Most read
3
Most read
10
Most read
Join Ordering in
Fragment Queries
By Shehab Uddin and Ifzal Hussain
Join Ordering in Fragment Queries
• Join ordering is important in centralized DB, and is more important in
distributed DB.
Join Ordering in Fragment Queries (cont.)
• R  site j: “relation R is transferred to site j”
• 1. EMP  site 2; site 2 computes EMP’
• EMP’->site 3; site 3 computes the result.
• 2.ASG->site 1: site 1 computes EMP’, EMP’->site
3; site 3 computes the result
• 3. ASG->site 3; computeASG’;ASG’->site 1
• 4. PROJ->site 2; compute PROJ’; PROJ’->site 1
• 5. EMP->site 2; PROJ->site 2; site 2 compute the
join.
Join Ordering in Fragment Queries (cont.)
• Join ordering
• Distributed INGRES
• System R*
• Semijoin ordering
• SDD-1
Join Ordering
• Consider two relations only
• R ⋈ S
• Transfer the smaller size
• Multiple relations more difficult because too many alternatives
• Compute the cost of all alternatives and select the best one
• Necessary to compute the size of intermediate relations which is difficult.
• Use heuristics
Join Ordering - Example
• Consider: PROJ ⋈PNO ASG ⋈ENO EMP
Join Ordering – Example (cont.)
• Execution alternatives:
• 1. EMP  Site 2
• Site 2 computes EMP’=EMP⋈ASG
• EMP’  Site 3
• Site 3 computes EMP’⋈PROJ
• 2.ASG  Site 1
• Site 1 computes EMP’=EMP⋈ASG
• EMP’  Site 3
• Site 3 computes EMP’⋈PROJ
Join Ordering – Example (cont.)
3. ASG  Site 3
Site 3 computes ASG’=ASG⋈PROJ
ASG’  Site 1
Site 1 computes ASG’⋈EMP
4. PROJ  Site 2
Site 2 computes PROJ’=PROJ⋈ASG
PROJ’  Site 1
Site 1 computes PROJ’ ⋈ EMP
cont,d
5. EMP  Site 2
PROJ  Site 2
Site 2 computes EMP⋈ PROJ⋈ASG
Semijoin Algorithms
• Shortcoming of the joining method
• Transfer the entire relation which may contain some useless tuples
• Semi-join reduces the size of operand relation to be transferred
• Semi-join is beneficial if the cost to produce and send to the other site is less than
sending the whole relation.
Semijoin Algorithms (cont.)
• Consider the join of two relations
• R[A] (located at site 1)
• S[A] (located at site 2)
• Alternatives
• 1. Do the join R ⋈A S
• 2. Perform one of the semijoin equivalents
( ) ( )
( ) ( )
A A A A A
A A A
R S R S S R S R
R S S R
   
  
Cnt,d
• Perform the join
• Send R to site 2
• Site 2 computes R ⋈A S
• Consider semijoin
• S’ = A(S)
• S’  Site 1
• Site 1 computes
• R’  Site 2
• Site 2 computes
• Semijoin is better if
( )
A A
R S S

' '
A
R R S
 
' A
R S
( ( ( )) ( )) ( )
A A
size S size R S size R
   
Join ordering in fragment queries

More Related Content

PPTX
Distributed DBMS - Unit 6 - Query Processing
PPTX
Distributed design alternatives
PPTX
Distributed DBMS - Unit 5 - Semantic Data Control
PDF
management of distributed transactions
PPTX
Distributed database management system
PPT
PPTX
Database , 12 Reliability
PDF
Deadlock in Distributed Systems
Distributed DBMS - Unit 6 - Query Processing
Distributed design alternatives
Distributed DBMS - Unit 5 - Semantic Data Control
management of distributed transactions
Distributed database management system
Database , 12 Reliability
Deadlock in Distributed Systems

What's hot (20)

PPTX
Lec 7 query processing
PPTX
Distributed Query Processing
PPTX
Query processing in Distributed Database System
PPTX
DISTRIBUTED DATABASE WITH RECOVERY TECHNIQUES
PPTX
Distributed dbms architectures
PPTX
Fragmentation and types of fragmentation in Distributed Database
PPTX
Lecture 3 threads
PDF
DDBMS_ Chap 7 Optimization of Distributed Queries
PPTX
Concurrency Control in Distributed Database.
PDF
Deadlock Avoidance - OS
PPTX
Distributed Mutual Exclusion and Distributed Deadlock Detection
PPT
File models and file accessing models
PPTX
Distributed file system
PPTX
Database , 8 Query Optimization
PPTX
Distributed concurrency control
PPTX
CPU Scheduling in OS Presentation
PPT
Distributed Database System
PPTX
Distributed DBMS - Unit 3 - Distributed DBMS Architecture
PPTX
Replication Techniques for Distributed Database Design
Lec 7 query processing
Distributed Query Processing
Query processing in Distributed Database System
DISTRIBUTED DATABASE WITH RECOVERY TECHNIQUES
Distributed dbms architectures
Fragmentation and types of fragmentation in Distributed Database
Lecture 3 threads
DDBMS_ Chap 7 Optimization of Distributed Queries
Concurrency Control in Distributed Database.
Deadlock Avoidance - OS
Distributed Mutual Exclusion and Distributed Deadlock Detection
File models and file accessing models
Distributed file system
Database , 8 Query Optimization
Distributed concurrency control
CPU Scheduling in OS Presentation
Distributed Database System
Distributed DBMS - Unit 3 - Distributed DBMS Architecture
Replication Techniques for Distributed Database Design
Ad

Similar to Join ordering in fragment queries (20)

PPT
lecture14.ppt
PDF
Query Processing, Query Optimization and Transaction
PPTX
Relational Model
PPT
Distributed query processing for Advance database technology .ppt
PDF
_b65e7611894ba175de27bd14793f894a_15UnionFind.pdf
PPTX
Join operation
PPTX
Join Operation.pptx
PDF
Algorithms, Union Find
PDF
15 unionfind
PPTX
unit-2 Query processing and optimization,Query equivalence, Join strategies.pptx
PPTX
Relational Algebra Operator With Example
PPTX
8 drived horizontal fragmentation
PPTX
Query processing
PDF
PPT
Structure of Z Formal methods Lecture
PPTX
Data structure and algorithms
PPT
lefg sdfg ssdfg sdfg sdfg sdfg sdfg sdfg sdfg sdfg sdfg sdfg sdfg sdfg sdfg d...
PPT
lecture8Alg.ppt
PDF
Cs501 rel algebra
lecture14.ppt
Query Processing, Query Optimization and Transaction
Relational Model
Distributed query processing for Advance database technology .ppt
_b65e7611894ba175de27bd14793f894a_15UnionFind.pdf
Join operation
Join Operation.pptx
Algorithms, Union Find
15 unionfind
unit-2 Query processing and optimization,Query equivalence, Join strategies.pptx
Relational Algebra Operator With Example
8 drived horizontal fragmentation
Query processing
Structure of Z Formal methods Lecture
Data structure and algorithms
lefg sdfg ssdfg sdfg sdfg sdfg sdfg sdfg sdfg sdfg sdfg sdfg sdfg sdfg sdfg d...
lecture8Alg.ppt
Cs501 rel algebra
Ad

Recently uploaded (20)

PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Empathic Computing: Creating Shared Understanding
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
KodekX | Application Modernization Development
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PPTX
Spectroscopy.pptx food analysis technology
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Encapsulation theory and applications.pdf
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Machine learning based COVID-19 study performance prediction
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Empathic Computing: Creating Shared Understanding
Reach Out and Touch Someone: Haptics and Empathic Computing
NewMind AI Weekly Chronicles - August'25 Week I
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
KodekX | Application Modernization Development
MIND Revenue Release Quarter 2 2025 Press Release
Spectroscopy.pptx food analysis technology
Digital-Transformation-Roadmap-for-Companies.pptx
20250228 LYD VKU AI Blended-Learning.pptx
Encapsulation theory and applications.pdf
Encapsulation_ Review paper, used for researhc scholars
Mobile App Security Testing_ A Comprehensive Guide.pdf
Building Integrated photovoltaic BIPV_UPV.pdf
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Per capita expenditure prediction using model stacking based on satellite ima...
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
MYSQL Presentation for SQL database connectivity
Spectral efficient network and resource selection model in 5G networks
Machine learning based COVID-19 study performance prediction

Join ordering in fragment queries

  • 1. Join Ordering in Fragment Queries By Shehab Uddin and Ifzal Hussain
  • 2. Join Ordering in Fragment Queries • Join ordering is important in centralized DB, and is more important in distributed DB.
  • 3. Join Ordering in Fragment Queries (cont.) • R  site j: “relation R is transferred to site j” • 1. EMP  site 2; site 2 computes EMP’ • EMP’->site 3; site 3 computes the result. • 2.ASG->site 1: site 1 computes EMP’, EMP’->site 3; site 3 computes the result • 3. ASG->site 3; computeASG’;ASG’->site 1 • 4. PROJ->site 2; compute PROJ’; PROJ’->site 1 • 5. EMP->site 2; PROJ->site 2; site 2 compute the join.
  • 4. Join Ordering in Fragment Queries (cont.) • Join ordering • Distributed INGRES • System R* • Semijoin ordering • SDD-1
  • 5. Join Ordering • Consider two relations only • R ⋈ S • Transfer the smaller size • Multiple relations more difficult because too many alternatives • Compute the cost of all alternatives and select the best one • Necessary to compute the size of intermediate relations which is difficult. • Use heuristics
  • 6. Join Ordering - Example • Consider: PROJ ⋈PNO ASG ⋈ENO EMP
  • 7. Join Ordering – Example (cont.) • Execution alternatives: • 1. EMP  Site 2 • Site 2 computes EMP’=EMP⋈ASG • EMP’  Site 3 • Site 3 computes EMP’⋈PROJ • 2.ASG  Site 1 • Site 1 computes EMP’=EMP⋈ASG • EMP’  Site 3 • Site 3 computes EMP’⋈PROJ
  • 8. Join Ordering – Example (cont.) 3. ASG  Site 3 Site 3 computes ASG’=ASG⋈PROJ ASG’  Site 1 Site 1 computes ASG’⋈EMP 4. PROJ  Site 2 Site 2 computes PROJ’=PROJ⋈ASG PROJ’  Site 1 Site 1 computes PROJ’ ⋈ EMP
  • 9. cont,d 5. EMP  Site 2 PROJ  Site 2 Site 2 computes EMP⋈ PROJ⋈ASG
  • 10. Semijoin Algorithms • Shortcoming of the joining method • Transfer the entire relation which may contain some useless tuples • Semi-join reduces the size of operand relation to be transferred • Semi-join is beneficial if the cost to produce and send to the other site is less than sending the whole relation.
  • 11. Semijoin Algorithms (cont.) • Consider the join of two relations • R[A] (located at site 1) • S[A] (located at site 2) • Alternatives • 1. Do the join R ⋈A S • 2. Perform one of the semijoin equivalents ( ) ( ) ( ) ( ) A A A A A A A A R S R S S R S R R S S R       
  • 12. Cnt,d • Perform the join • Send R to site 2 • Site 2 computes R ⋈A S • Consider semijoin • S’ = A(S) • S’  Site 1 • Site 1 computes • R’  Site 2 • Site 2 computes • Semijoin is better if ( ) A A R S S  ' ' A R R S   ' A R S ( ( ( )) ( )) ( ) A A size S size R S size R    