L2 Distributed QueryProcessing
L2 Distributed QueryProcessing
These slides are a modified version of the slides provided with the book
Özsu and Valduriez, Principles of Distributed Database Systems (3rd Ed.), 2011
The original version of the slides is available at: extras.springer.com
⋆ Özsu and Valduriez, Principles of Distributed Database Systems (3rd Ed.), 2011
1
10-08-2024
Outline (today)
• Query decomposition and data localization (Ch. 7) ⋆
➡ The problem of distributed data localization
➡ A naïve algorithm
➡ Optimization steps (reductions)
✦ PHF (selection, join)
✦ VF (projection)
✦ DHF (join)
✦ Hybrid Fragmentation (selection/join + projection)
⋆ Özsu and Valduriez, Principles of Distributed Database Systems (3rd Ed.), 2011
Data Localization
Input: Relational algebra expression on global, distributed relations (distributed
query)
Output: Relational algebra expression on fragments (localized query)
• Localization uses global information about distribution of fragments (no use of
quantitative information, e.g., catalog statistics)
• Recall that fragmentation is obtained by several application of rules expressed
by relational algebra …
➡ primary horizontal fragmentation: selection σ
➡ derived horizontal fragmentation: semijoin ⋉
➡ vertical fragmentation: projection
2
10-08-2024
Example
Assume
EMP ⋈ ASG
• EMP is fragmented as follows:
=
(EMP1 ∪ EMP2 ∪ EMP3) ⋈ (ASG1 ∪ ASG2 )
➡ EMP1= ENO≤“E3”(EMP)
➡ EMP2= “E3”<ENO≤“E6”(EMP)
➡ EMP3= ENO≥“E6”(EMP)
➡ ASG1= ENO≤“E3”(ASG)
➡ ASG2= ENO>“E3”(ASG)
3
10-08-2024
Provides Parallellism
( EMP1 ∪ EMP2 ∪ EMP3) ⋈ (ASG1 ∪ ASG2 )
EMP1= ENO≤“E3”(EMP)
=
EMP2= “E3”<ENO≤“E6”(EMP) ( EMP1 ⋈ ASG1) ∪ ( EMP1 ⋈ ASG2) ∪
EMP3= ENO≥“E6”(EMP) ( EMP2 ⋈ ASG1) ∪ ( EMP2 ⋈ ASG2) ∪
( EMP3 ⋈ ASG1) ∪ ( EMP3 ⋈ ASG2)
ASG1= ENO≤“E3”(ASG)
ASG2= ENO>“E3”(ASG)
⋈ENO
EMP1 ASG1 EMP1 ASG2 EMP2 ASG1 EMP2 ASG2 EMP3 ASG1 EMP3 ASG2
Identify (pairs of) fragments that can be ignored because they produce
empty relations (e.g., when a selection or a join is applied to them)
Distributed DBMS © M. T. Özsu & P. Valduriez
Ch.7/8
4
10-08-2024
10
5
10-08-2024
✦ Given Ri =pi(R) and Sj = pj(S) [pi and pj defined over join attributes]
11
12
6
10-08-2024
Reduction for VF
• Reduction of a projection over a relation fragmented with VF: ignore the fragment for
which the set of fragmentation attributes intersected with the set of projection
attributes is contained in the primary key
• Recall that the localization program consists in joins over key attributes
• Let R1 be a fragment of R obtained as R1 = A’ (R) where A’ attr(R) :
➡ Reduction of a projection A’’ over R1 is possible when A’’ ∩ A’ key(R)
13
14
7
10-08-2024
⋈ENO
⋈ENO ⋈ENO
15
16
8
10-08-2024
17
18