SlideShare a Scribd company logo
1 of 53
Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/1
Outline
• Introduction
• Background
• Distributed Database Design
• Database Integration
• Semantic Data Control
• Distributed Query Processing
➡ Overview
➡ Query decomposition and localization
➡ Distributed query optimization
• Multidatabase Query Processing
• Distributed Transaction Management
• Data Replication
• Parallel Database Systems
• Distributed Object DBMS
• Peer-to-Peer Data Management
• Web Data Management
• Current Issues
Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/2
Step 3 – Global Query
Optimization
Input: Fragment query
• Find the best (not necessarily optimal) global schedule
➡ Minimize a cost function
➡ Distributed join processing
✦ Bushy vs. linear trees
✦ Which relation to ship where?
✦ Ship-whole vs ship-as-needed
➡ Decide on the use of semijoins
✦ Semijoin saves on communication at the expense of more local processing.
➡ Join methods
✦ nested loop vs ordered joins (merge join or hash join)
Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/3
Cost-Based Optimization
• Solution space
➡ The set of equivalent algebra expressions (query trees).
• Cost function (in terms of time)
➡ I/O cost + CPU cost + communication cost
➡ These might have different weights in different distributed environments
(LAN vs WAN).
➡ Can also maximize throughput
• Search algorithm
➡ How do we move inside the solution space?
➡ Exhaustive search, heuristic algorithms (iterative improvement, simulated
annealing, genetic,…)
Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/4
Query Optimization Process
Search Space
Generation
Search
Strategy
Equivalent QEP
Input Query
Transformation
Rules
Cost Model
Best QEP
Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/5
Search Space
• Search space characterized by
alternative execution
• Focus on join trees
• For N relations, there are O(N!)
equivalent join trees that can be
obtained by applying
commutativity and associativity
rules
SELECT ENAME,RESP
FROM EMP, ASG,PROJ
WHERE EMP.ENO=ASG.ENO
AND ASG.PNO=PROJ.PNO
PROJ
ASGEMP
PROJ ASG
EMP
PROJ
ASG
EMP
×
▷◁PNO
▷◁ENO
▷◁PNO
▷◁ENO
▷◁ENO,PNO
Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/6
Search Space
 Restrict by means of heuristics
 Perform unary operations before binary operations
 …
 Restrict the shape of the join tree
➡ Consider only linear trees, ignore bushy ones
Linear Join Tree Bushy Join Tree
R2R1
R3
R4
R2R1 R4R3
⋈
⋈
⋈
⋈
⋈ ⋈
Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/7
Search Strategy
 How to “move” in the search space.
 Deterministic
 Start from base relations and build plans by adding one relation at each step
 Dynamic programming: breadth-first
 Greedy: depth-first
 Randomized
 Search for optimalities around a particular starting point
 Trade optimization time for execution time
 Better when > 10 relations
 Simulated annealing
 Iterative improvement
Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/8
Search Strategies
• Deterministic
R2R1
R3
R4
R2R1 R2R1
R3
R2R1
R3
R3R1
R2
• Randomized
⋈⋈
⋈
⋈
⋈
⋈
⋈
⋈ ⋈
⋈
Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/9
Cost Functions
• Total Time (or Total Cost)
➡ Reduce each cost (in terms of time) component individually
➡ Do as little of each cost component as possible
➡ Optimizes the utilization of the resources
Increases system throughput
• Response Time
➡ Do as many things as possible in parallel
➡ May increase total time because of increased total activity
Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/10
Total Cost
Summation of all cost factors
Total cost = CPU cost + I/O cost + communication cost
CPU cost = unit instruction cost no.of instructions
I/O cost = unit disk I/O cost no. of disk I/Os
communication cost = message initiation + transmission
Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/11
Total Cost Factors
• Wide area network
➡ Message initiation and transmission costs high
➡ Local processing cost is low (fast mainframes or minicomputers)
➡ Ratio of communication to I/O costs = 20:1
• Local area networks
➡ Communication and local processing costs are more or less equal
➡ Ratio = 1:1.6
Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/12
Response Time
Elapsed time between the initiation and the completion of a query
Response time = CPU time + I/O time + communication time
CPU time = unit instruction time * no. of sequential instructions
I/O time = unit I/O time * no. of sequential I/Os
communication time = unit msg initiation time * no. of sequential msg
+ unit transmission time * no. of sequential bytes
Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/13
Example
Assume that only the communication cost is considered
Total time = 2 × message initialization time + unit transmission time * (x+y)
Response time = max {time to send x from 1 to 3, time to send y from 2 to 3}
time to send x from 1 to 3 = message initialization time
+ unit transmission time * x
time to send y from 2 to 3 = message initialization time
+ unit transmission time * y
Site 1
Site 2
x units
y units
Site 3
Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/14
Optimization Statistics
• Primary cost factor: size of intermediate relations
➡ Need to estimate their sizes
• Make them precise more costly to maintain
• Simplifying assumption: uniform distribution of attribute values in a
relation
Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/15
Statistics
• For each relation R[A1, A2, …, An] fragmented as R1, …, Rr
➡ length of each attribute: length(Ai)
➡ the number of distinct values for each attribute in each fragment:
card( Ai
Rj)
➡ maximum and minimum values in the domain of each attribute:
min(Ai), max(Ai)
➡ the cardinalities of each domain: card(dom[Ai])
• The cardinalities of each fragment: card(Rj) Selectivity factor of each
operation for relations
➡For joins
SF ⋈ (R,S) =
card(R ⋈S)
card(R) card(S)
Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/16
Intermediate Relation Sizes
Selection
size(R) = card(R) × length(R)
card( F(R)) = SF (F) × card(R)
where
S F (A = value) =
card(∏A(R))
1
S F (A >value) =
max(A) – min(A)
max(A) – value
S F (A <value) =
max(A) – min(A)
value – max(A)
SF (p(Ai) p(Aj)) = SF (p(Ai)) × SF (p(Aj))
SF (p(Ai) p(Aj)) = SF (p(Ai)) + SF (p(Aj)) – (SF (p(Ai)) × SF (p(Aj)))
SF (A value}) = SF (A= value) * card({values})
Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/17
Intermediate Relation Sizes
Projection
card( A(R))=card(R)
Cartesian Product
card(R × S) = card(R) * card(S)
Union
upper bound: card(R S) = card(R) + card(S)
lower bound: card(R S) = max{card(R), card(S)}
Set Difference
upper bound: card(R–S) = card(R)
lower bound: 0
Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/18
Intermediate Relation Size
Join
➡ Special case: A is a key of R and B is a foreign key of S
card(R ⋈A=B S) = card(S)
➡ More general:
card(R ⋈ S) = SF⋈ * card(R) × card(S)
Semijoin
card(R ⋉A S) = SF⋉(S.A) * card(R)
where
SF⋉(R ⋉A S)= SF⋉(S.A) =
card(∏A(S))
card(dom[A])
Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/19
Histograms for Selectivity
Estimation
• For skewed data, the uniform distribution assumption of attribute values
yields inaccurate estimations
• Use an histogram for each skewed attribute A
➡ Histogram = set of buckets
✦ Each bucket describes a range of values of A, with its average frequency f
(number of tuples with A in that range) and number of distinct values d
✦ Buckets can be adjusted to different ranges
• Examples
➡ Equality predicate
✦ With (value in Rangei), we have: SF (A = value) = 1/di
➡ Range predicate
✦ Requires identifying relevant buckets and summing up their frequencies
Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/20
Histogram Example
For ASG.DUR=18: we have SF=1/12 so the card of selection is 300/12
= 25 tuples
For ASG.DUR≤18: we have min(range3)=12 and max(range3)=24 so the
card. of selection is 100+75+(((18−12)/(24 − 12))*50) = 200 tuples
Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/21
Centralized Query Optimization
• Dynamic (Ingres project at UCB)
➡ Interpretive
• Static (System R project at IBM)
➡ Exhaustive search
• Hybrid (Volcano project at OGI)
➡ Choose node within plan
Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/22
Dynamic Algorithm
 Decompose each multi-variable query into a sequence of mono-variable
queries with a common variable
 Process each by a one variable query processor
➡ Choose an initial execution plan (heuristics)
➡ Order the rest by considering intermediate relation sizes
No statistical information is maintained
Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/23
Dynamic Algorithm–
Decomposition
• Replace an n variable query q by a series of queries
q1 q2 … qn
where qi uses the result of qi-1.
• Detachment
➡ Query q decomposed into q' q" where q' and q" have a common variable
which is the result of q'
• Tuple substitution
➡ Replace the value of each tuple with actual values and simplify the query
q(V1, V2, ... Vn) (q' (t1, V2, V2, ... , Vn), t1 R)
Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/24
Detachment
q: SELECT V2.A2,V3.A3, …,Vn.An
FROM R1 V1, …,Rn Vn
WHERE P1(V1.A1
’)AND P2(V1.A1,V2.A2,…, Vn.An)
q': SELECT V1.A1 INTO R1'
FROM R1 V1
WHERE P1(V1.A1)
q": SELECT V2.A2, …,Vn.An
FROM R1' V1, R2 V2, …,Rn Vn
WHERE P2(V1.A1, V2.A2, …,Vn.An)
Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/25
Detachment Example
Names of employees working on CAD/CAM project
q1:SELECT EMP.ENAME
FROM EMP, ASG, PROJ
WHERE EMP.ENO=ASG.ENO
AND ASG.PNO=PROJ.PNO
AND PROJ.PNAME="CAD/CAM"
q11: SELECT PROJ.PNO INTO JVAR
FROM PROJ
WHERE PROJ.PNAME="CAD/CAM"
q': SELECT EMP.ENAME
FROM EMP,ASG,JVAR
WHERE EMP.ENO=ASG.ENO
AND ASG.PNO=JVAR.PNO
Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/26
Detachment Example (cont’d)
q': SELECT EMP.ENAME
FROM EMP,ASG,JVAR
WHERE EMP.ENO=ASG.ENO
AND ASG.PNO=JVAR.PNO
q12: SELECT ASG.ENO INTO GVAR
FROM ASG,JVAR
WHERE ASG.PNO=JVAR.PNO
q13: SELECT EMP.ENAME
FROM EMP,GVAR
WHERE EMP.ENO=GVAR.ENO
Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/27
Tuple Substitution
q11 is a mono-variable query
q12 and q13 is subject to tuple substitution
Assume GVAR has two tuples only: 〈E1〉 and 〈E2〉
Then q13 becomes
q131: SELECT EMP.ENAME
FROM EMP
WHERE EMP.ENO="E1"
q132: SELECT EMP.ENAME
FROM EMP
WHERE EMP.ENO="E2"
Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/28
Static Algorithm
 Simple (i.e., mono-relation) queries are executed according to the best
access path
 Execute joins
➡ Determine the possible ordering of joins
➡ Determine the cost of each ordering
➡ Choose the join ordering with minimal cost
Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/29
Static Algorithm
For joins, two alternative algorithms :
• Nested loops
for each tuple of external relation (cardinality n1)
for each tuple of internal relation (cardinality n2)
join two tuples if the join predicate is true
end
end
➡ Complexity: n1* n2
• Merge join
sort relations
merge relations
➡ Complexity: n1+ n2 if relations are previously sorted and equijoin
Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/30
Static Algorithm – Example
Names of employees working on the CAD/CAM project
Assume
➡ EMP has an index on ENO,
➡ ASG has an index on PNO,
➡ PROJ has an index on PNO and an index on PNAME
PNOENO
PROJ
ASG
EMP
Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/31
Example (cont’d)
 Choose the best access paths to each relation
➡ EMP: sequential scan (no selection on EMP)
➡ ASG: sequential scan (no selection on ASG)
➡ PROJ: index on PNAME (there is a selection on PROJ based on PNAME)
 Determine the best join ordering
➡ EMP ▷◁ASG ▷◁PROJ
➡ ASG ▷◁PROJ ▷◁EMP
➡ PROJ ▷◁ASG ▷◁EMP
➡ ASG ▷◁EMP ▷◁PROJ
➡ EMP × PROJ ▷◁ASG
➡ PRO × JEMP ▷◁ASG
➡ Select the best ordering based on the join costs evaluated according to the
two methods
Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/32
Static Algorithm
Best total join order is one of
((ASG ⋈ EMP) ⋈ PROJ)
((PROJ ⋈ ASG) ⋈ EMP)
ASGEMP PROJ
EMP × PROJ
pruned
PROJ × EMP
pruned
Alternatives
EMP ⋈ ASG
pruned
(ASG ⋈ EMP) ⋈ PROJ
ASG ⋈ EMP ASG ⋈ PROJ
pruned
PROJ ⋈
ASG
(PROJ ⋈ ASG) ⋈
EMP
Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/33
Static Algorithm
• ((PROJ ⋈ ASG) ⋈ EMP) has a useful index on the select attribute and
direct access to the join attributes of ASG and EMP
• Therefore, chose it with the following access methods:
➡ select PROJ using index on PNAME
➡ then join with ASG using index on PNO
➡ then join with EMP using index on ENO
Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/34
Hybrid optimization
• In general, static optimization is more efficient than dynamic optimization
➡ Adopted by all commercial DBMS
• But even with a sophisticated cost model (with histograms), accurate cost
prediction is difficult
• Example
➡ Consider a parametric query with predicate
WHERE R.A = $a /* $a is a parameter
➡ The only possible assumption at compile time is uniform distribution of
values
• Solution: Hybrid optimization
➡ Choose-plan done at runtime, based on the actual parameter binding
Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/35
Hybrid Optimization Example
$a=A
$a=A
Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/36
Join Ordering in Fragment
Queries
• Ordering joins
➡ Distributed INGRES
➡ System R*
➡ Two-step
• Semijoin ordering
➡ SDD-1
Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/37
Join Ordering
• 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
R
if size(R) < size(S)
if size(R) > size(S)
S
• Consider two relations only
Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/38
Join Ordering – Example
Consider
PROJ ⋈PNO ASG ⋈ENO EMP
Site 2
Site 3Site 1
PNOENO
PROJ
ASG
EMP
Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/39
Join Ordering – Example
Execution alternatives:
1. EMP Site 2 2. ASG Site 1
Site 2 computes EMP'=EMP ⋈ ASG Site 1 computes EMP'=EMP⋈ ASG
EMP' Site 3 EMP' Site 3
Site 3 computes EMP' ⋈ PROJ Site 3 computes EMP’ ⋈ PROJ
3. ASG Site 3 4. PROJ Site 2
Site 3 computes ASG'=ASG ⋈ PROJ Site 2 computes PROJ'=PROJ ⋈ ASG
ASG' Site 1 PROJ' Site 1
Site 1 computes ASG' ▷◁EMP Site 1 computes PROJ' ⋈ EMP
5. EMP Site 2
PROJ Site 2
Site 2 computes EMP ⋈ PROJ ⋈ ASG
Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/40
Semijoin Algorithms
• Consider the join of two relations:
➡ R[A] (located at site 1)
➡ S[A](located at site 2)
• Alternatives:
1. Do the join R ⋈AS
2. Perform one of the semijoin equivalents
R⋈AS (R ⋉AS) ⋈AS
R ⋈A (S ⋉A R)
(R ⋉A S) ⋈A (S ⋉A R)
Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/41
Semijoin Algorithms
• Perform the join
➡ send R to Site 2
➡ Site 2 computes R ⋈A S
• Consider semijoin (R ⋉AS) ⋈AS
➡ S' = A(S)
➡ S' Site 1
➡ Site 1 computes R' = R ⋉AS'
➡ R' Site 2
➡ Site 2 computes R' ⋈AS
Semijoin is better if
size( A(S)) + size(R ⋉AS)) < size(R)
Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/42
Distributed Dynamic Algorithm
1. Execute all monorelation queries (e.g., selection, projection)
2. Reduce the multirelation query to produce irreducible subqueries
q1 q2 … qnsuch that there is only one relation between qi and qi+1
1. Choose qi involving the smallest fragments to execute (call MRQ')
2. Find the best execution strategy for MRQ'
a) Determine processing site
b) Determine fragments to move
3. Repeat 3 and 4
Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/43
Static Approach
• Cost function includes local processing as well as transmission
• Considers only joins
• “Exhaustive” search
• Compilation
• Published papers provide solutions to handling horizontal and vertical
fragmentations but the implemented prototype does not
Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/44
Static Approach – Performing
Joins
• Ship whole
➡ Larger data transfer
➡ Smaller number of messages
➡ Better if relations are small
• Fetch as needed
➡ Number of messages = O(cardinality of external relation)
➡ Data transfer per message is minimal
➡ Better if relations are large and the selectivity is good
Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/45
Static Approach –
Vertical Partitioning & Joins
1. Move outer relation tuples to the site of the inner relation
(a) Retrieve outer tuples
(b) Send them to the inner relation site
(c) Join them as they arrive
Total Cost = cost(retrieving qualified outer tuples)
+ no. of outer tuples fetched * cost(retrieving qualified
inner tuples)
+ msg. cost * (no. outer tuples fetched * avg. outer
tuple size)/msg. size
Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/46
Static Approach –
Vertical Partitioning & Joins
2. Move inner relation to the site of outer relation
Cannot join as they arrive; they need to be stored
Total cost = cost(retrieving qualified outer tuples)
+ no. of outer tuples fetched * cost(retrieving
matching inner tuples from temporary storage)
+ cost(retrieving qualified inner tuples)
+ cost(storing all qualified inner tuples in temporary
storage)
+ msg. cost * no. of inner tuples fetched * avg. inner
tuple size/msg. size
Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/47
Static Approach –
Vertical Partitioning & Joins
3. Move both inner and outer relations to another site
Total cost = cost(retrieving qualified outer tuples)
+ cost(retrieving qualified inner tuples)
+ cost(storing inner tuples in storage)
+ msg. cost × (no. of outer tuples fetched * avg. outer
tuple size)/msg. size
+ msg. cost * (no. of inner tuples fetched * avg. inner
tuple size)/msg. size
+ no. of outer tuples fetched * cost(retrieving inner
tuples from temporary storage)
Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/48
Static Approach –
Vertical Partitioning & Joins
4.Fetch inner tuples as needed
(a) Retrieve qualified tuples at outer relation site
(b) Send request containing join column value(s) for outer tuples to inner
relation site
(c) Retrieve matching inner tuples at inner relation site
(d)Send the matching inner tuples to outer relation site
(e) Join as they arrive
Total Cost = cost(retrieving qualified outer tuples)
+ msg. cost * (no. of outer tuples fetched)
+ no. of outer tuples fetched * no. of
inner tuples fetched * avg. inner tuple
size * msg. cost / msg. size)
+ no. of outer tuples fetched * cost(retrieving
matching inner tuples for one outer value)
Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/49
Dynamic vs. Static vs Semijoin
• Semijoin
➡ SDD1 selects only locally optimal schedules
• Dynamic and static approaches have the same advantages and drawbacks
as in centralized case
➡ But the problems of accurate cost estimation at compile-time are more severe
✦ More variations at runtime
✦ Relations may be replicated, making site and copy selection important
• Hybrid optimization
➡ Choose-plan approach can be used
➡ 2-step approach simpler
Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/50
2-Step Optimization
1. At compile time, generate a static plan with operation ordering and
access methods only
2. At startup time, carry out site and copy selection and allocate operations
to sites
Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/51
2-Step – Problem Definition
• Given
➡ A set of sites S = {s1, s2, …,sn} with the load of each site
➡ A query Q ={q1, q2, q3, q4} such that each subquery qi is the maximum
processing unit that accesses one relation and communicates with its
neighboring queries
➡ For each qi in Q, a feasible allocation set of sites Sq={s1, s2, …,sk} where each site
stores a copy of the relation in qi
• The objective is to find an optimal allocation of Q to S such that
➡ the load unbalance of S is minimized
➡ The total communication cost is minimized
Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/52
2-Step Algorithm
• For each q in Q compute load (Sq)
• While Q not empty do
1. Select subquery a with least allocation flexibility
2. Select best site b for a (with least load and best benefit)
3. Remove a from Q and recompute loads if needed
Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/53
2-Step Algorithm Example
• Let Q = {q1, q2, q3, q4} where q1 is
associated with R1, q2 is associated
with R2 joined with the result of
q1, etc.
• Iteration 1: select q4, allocate to
s1, set load(s1)=2
• Iteration 2: select q2, allocate to
s2, set load(s2)=3
• Iteration 3: select q3, allocate to
s1, set load(s1) =3
• Iteration 4: select q1, allocate to s3 or
s4
Note: if in iteration 2, q2, were allocated to s4, this would have produced
a better plan. So hybrid optimization can still miss optimal plans

More Related Content

What's hot

Lock based protocols
Lock based protocolsLock based protocols
Lock based protocolsChethanMp7
 
management of distributed transactions
management of distributed transactionsmanagement of distributed transactions
management of distributed transactionsNilu Desai
 
15. Transactions in DBMS
15. Transactions in DBMS15. Transactions in DBMS
15. Transactions in DBMSkoolkampus
 
Concurrency Control in Distributed Database.
Concurrency Control in Distributed Database.Concurrency Control in Distributed Database.
Concurrency Control in Distributed Database.Meghaj Mallick
 
Distributed concurrency control
Distributed concurrency controlDistributed concurrency control
Distributed concurrency controlBinte fatima
 
Distributed database management system
Distributed database management  systemDistributed database management  system
Distributed database management systemPooja Dixit
 
Query processing in Distributed Database System
Query processing in Distributed Database SystemQuery processing in Distributed Database System
Query processing in Distributed Database SystemMeghaj Mallick
 
Design issues of dos
Design issues of dosDesign issues of dos
Design issues of dosvanamali_vanu
 
Matching techniques
Matching techniquesMatching techniques
Matching techniquesNagpalkirti
 
Database ,11 Concurrency Control
Database ,11 Concurrency ControlDatabase ,11 Concurrency Control
Database ,11 Concurrency ControlAli Usman
 
Database, 3 Distribution Design
Database, 3 Distribution DesignDatabase, 3 Distribution Design
Database, 3 Distribution DesignAli Usman
 
14. Query Optimization in DBMS
14. Query Optimization in DBMS14. Query Optimization in DBMS
14. Query Optimization in DBMSkoolkampus
 
Load Balancing In Distributed Computing
Load Balancing In Distributed ComputingLoad Balancing In Distributed Computing
Load Balancing In Distributed ComputingRicha Singh
 
13. Query Processing in DBMS
13. Query Processing in DBMS13. Query Processing in DBMS
13. Query Processing in DBMSkoolkampus
 
File models and file accessing models
File models and file accessing modelsFile models and file accessing models
File models and file accessing modelsishmecse13
 
Distributed file system
Distributed file systemDistributed file system
Distributed file systemAnamika Singh
 
Query optimization
Query optimizationQuery optimization
Query optimizationPooja Dixit
 

What's hot (20)

Lock based protocols
Lock based protocolsLock based protocols
Lock based protocols
 
management of distributed transactions
management of distributed transactionsmanagement of distributed transactions
management of distributed transactions
 
serializability in dbms
serializability in dbmsserializability in dbms
serializability in dbms
 
15. Transactions in DBMS
15. Transactions in DBMS15. Transactions in DBMS
15. Transactions in DBMS
 
Concurrency Control in Distributed Database.
Concurrency Control in Distributed Database.Concurrency Control in Distributed Database.
Concurrency Control in Distributed Database.
 
Distributed concurrency control
Distributed concurrency controlDistributed concurrency control
Distributed concurrency control
 
Distributed database management system
Distributed database management  systemDistributed database management  system
Distributed database management system
 
Query processing in Distributed Database System
Query processing in Distributed Database SystemQuery processing in Distributed Database System
Query processing in Distributed Database System
 
Design issues of dos
Design issues of dosDesign issues of dos
Design issues of dos
 
Matching techniques
Matching techniquesMatching techniques
Matching techniques
 
Database ,11 Concurrency Control
Database ,11 Concurrency ControlDatabase ,11 Concurrency Control
Database ,11 Concurrency Control
 
Lec 7 query processing
Lec 7 query processingLec 7 query processing
Lec 7 query processing
 
Database, 3 Distribution Design
Database, 3 Distribution DesignDatabase, 3 Distribution Design
Database, 3 Distribution Design
 
14. Query Optimization in DBMS
14. Query Optimization in DBMS14. Query Optimization in DBMS
14. Query Optimization in DBMS
 
Load Balancing In Distributed Computing
Load Balancing In Distributed ComputingLoad Balancing In Distributed Computing
Load Balancing In Distributed Computing
 
Distributed Transaction
Distributed TransactionDistributed Transaction
Distributed Transaction
 
13. Query Processing in DBMS
13. Query Processing in DBMS13. Query Processing in DBMS
13. Query Processing in DBMS
 
File models and file accessing models
File models and file accessing modelsFile models and file accessing models
File models and file accessing models
 
Distributed file system
Distributed file systemDistributed file system
Distributed file system
 
Query optimization
Query optimizationQuery optimization
Query optimization
 

Viewers also liked

Query optimization
Query optimizationQuery optimization
Query optimizationdixitdavey
 
Database system-DBMS
Database system-DBMSDatabase system-DBMS
Database system-DBMSikjsamuel
 
Characteristic of dabase approach
Characteristic of dabase approachCharacteristic of dabase approach
Characteristic of dabase approachLuina Pani
 
physical and logical data independence
physical and logical data independencephysical and logical data independence
physical and logical data independenceapoorva_upadhyay
 
6 Data Modeling for NoSQL 2/2
6 Data Modeling for NoSQL 2/26 Data Modeling for NoSQL 2/2
6 Data Modeling for NoSQL 2/2Fabio Fumarola
 
MS Sql Server: Introduction To Database Concepts
MS Sql Server: Introduction To Database ConceptsMS Sql Server: Introduction To Database Concepts
MS Sql Server: Introduction To Database ConceptsDataminingTools Inc
 
Database administrator
Database administratorDatabase administrator
Database administratorTech_MX
 
Single User v/s Multi User Databases
Single User v/s Multi User DatabasesSingle User v/s Multi User Databases
Single User v/s Multi User DatabasesRaminder Pal Singh
 
Database ,16 P2P
Database ,16 P2P Database ,16 P2P
Database ,16 P2P Ali Usman
 
Query Optimization
Query OptimizationQuery Optimization
Query Optimizationrohitsalunke
 
Database ,10 Transactions
Database ,10 TransactionsDatabase ,10 Transactions
Database ,10 TransactionsAli Usman
 
Database , 13 Replication
Database , 13 ReplicationDatabase , 13 Replication
Database , 13 ReplicationAli Usman
 
Database ,2 Background
 Database ,2 Background Database ,2 Background
Database ,2 BackgroundAli Usman
 
Database , 6 Query Introduction
Database , 6 Query Introduction Database , 6 Query Introduction
Database , 6 Query Introduction Ali Usman
 
8 query processing and optimization
8 query processing and optimization8 query processing and optimization
8 query processing and optimizationKumar
 
Chapter 1 Fundamentals of Database Management System
Chapter 1 Fundamentals of Database Management SystemChapter 1 Fundamentals of Database Management System
Chapter 1 Fundamentals of Database Management SystemEddyzulham Mahluzydde
 

Viewers also liked (20)

Query optimization
Query optimizationQuery optimization
Query optimization
 
Nitish 007
Nitish 007Nitish 007
Nitish 007
 
Database system-DBMS
Database system-DBMSDatabase system-DBMS
Database system-DBMS
 
Characteristic of dabase approach
Characteristic of dabase approachCharacteristic of dabase approach
Characteristic of dabase approach
 
Data model and entity relationship
Data model and entity relationshipData model and entity relationship
Data model and entity relationship
 
physical and logical data independence
physical and logical data independencephysical and logical data independence
physical and logical data independence
 
6 Data Modeling for NoSQL 2/2
6 Data Modeling for NoSQL 2/26 Data Modeling for NoSQL 2/2
6 Data Modeling for NoSQL 2/2
 
MS Sql Server: Introduction To Database Concepts
MS Sql Server: Introduction To Database ConceptsMS Sql Server: Introduction To Database Concepts
MS Sql Server: Introduction To Database Concepts
 
Database administrator
Database administratorDatabase administrator
Database administrator
 
Dbms slides
Dbms slidesDbms slides
Dbms slides
 
Single User v/s Multi User Databases
Single User v/s Multi User DatabasesSingle User v/s Multi User Databases
Single User v/s Multi User Databases
 
Database ,16 P2P
Database ,16 P2P Database ,16 P2P
Database ,16 P2P
 
Query Optimization
Query OptimizationQuery Optimization
Query Optimization
 
Database ,10 Transactions
Database ,10 TransactionsDatabase ,10 Transactions
Database ,10 Transactions
 
Database , 13 Replication
Database , 13 ReplicationDatabase , 13 Replication
Database , 13 Replication
 
Database ,2 Background
 Database ,2 Background Database ,2 Background
Database ,2 Background
 
Database , 6 Query Introduction
Database , 6 Query Introduction Database , 6 Query Introduction
Database , 6 Query Introduction
 
Query processing
Query processingQuery processing
Query processing
 
8 query processing and optimization
8 query processing and optimization8 query processing and optimization
8 query processing and optimization
 
Chapter 1 Fundamentals of Database Management System
Chapter 1 Fundamentals of Database Management SystemChapter 1 Fundamentals of Database Management System
Chapter 1 Fundamentals of Database Management System
 

Similar to Database , 8 Query Optimization

Database ,7 query localization
Database ,7 query localizationDatabase ,7 query localization
Database ,7 query localizationAli Usman
 
Database ,18 Current Issues
Database ,18 Current IssuesDatabase ,18 Current Issues
Database ,18 Current IssuesAli Usman
 
Algorithms for Query Processing and Optimization of Spatial Operations
Algorithms for Query Processing and Optimization of Spatial OperationsAlgorithms for Query Processing and Optimization of Spatial Operations
Algorithms for Query Processing and Optimization of Spatial OperationsNatasha Mandal
 
The Power of Motif Counting Theory, Algorithms, and Applications for Large Gr...
The Power of Motif Counting Theory, Algorithms, and Applications for Large Gr...The Power of Motif Counting Theory, Algorithms, and Applications for Large Gr...
The Power of Motif Counting Theory, Algorithms, and Applications for Large Gr...Nesreen K. Ahmed
 
Database , 4 Data Integration
Database , 4 Data IntegrationDatabase , 4 Data Integration
Database , 4 Data IntegrationAli Usman
 
Data structures assignmentweek4b.pdfCI583 Data Structure
Data structures assignmentweek4b.pdfCI583 Data StructureData structures assignmentweek4b.pdfCI583 Data Structure
Data structures assignmentweek4b.pdfCI583 Data StructureOllieShoresna
 
Parallel kmeans clustering in Erlang
Parallel kmeans clustering in ErlangParallel kmeans clustering in Erlang
Parallel kmeans clustering in ErlangChinmay Patel
 
Query Optimization - Brandon Latronica
Query Optimization - Brandon LatronicaQuery Optimization - Brandon Latronica
Query Optimization - Brandon Latronica"FENG "GEORGE"" YU
 
Efficient Query Processing in Web Search Engines
Efficient Query Processing in Web Search EnginesEfficient Query Processing in Web Search Engines
Efficient Query Processing in Web Search EnginesSimon Lia-Jonassen
 
Visualizing botnets with t-SNE
Visualizing botnets with t-SNEVisualizing botnets with t-SNE
Visualizing botnets with t-SNEmuayyad alsadi
 
IJSETR-VOL-3-ISSUE-12-3358-3363
IJSETR-VOL-3-ISSUE-12-3358-3363IJSETR-VOL-3-ISSUE-12-3358-3363
IJSETR-VOL-3-ISSUE-12-3358-3363SHIVA REDDY
 
MapReduceAlgorithms.ppt
MapReduceAlgorithms.pptMapReduceAlgorithms.ppt
MapReduceAlgorithms.pptCheeWeiTan10
 
Distributed Decision Tree Induction
Distributed Decision Tree InductionDistributed Decision Tree Induction
Distributed Decision Tree Inductiongregoryg
 
Hadoop Map Reduce OS
Hadoop Map Reduce OSHadoop Map Reduce OS
Hadoop Map Reduce OSVedant Mane
 
Advanced Non-Relational Schemas For Big Data
Advanced Non-Relational Schemas For Big DataAdvanced Non-Relational Schemas For Big Data
Advanced Non-Relational Schemas For Big DataVictor Smirnov
 

Similar to Database , 8 Query Optimization (20)

6-Query_Intro (5).pdf
6-Query_Intro (5).pdf6-Query_Intro (5).pdf
6-Query_Intro (5).pdf
 
Database ,7 query localization
Database ,7 query localizationDatabase ,7 query localization
Database ,7 query localization
 
Database ,18 Current Issues
Database ,18 Current IssuesDatabase ,18 Current Issues
Database ,18 Current Issues
 
Algorithms for Query Processing and Optimization of Spatial Operations
Algorithms for Query Processing and Optimization of Spatial OperationsAlgorithms for Query Processing and Optimization of Spatial Operations
Algorithms for Query Processing and Optimization of Spatial Operations
 
The Power of Motif Counting Theory, Algorithms, and Applications for Large Gr...
The Power of Motif Counting Theory, Algorithms, and Applications for Large Gr...The Power of Motif Counting Theory, Algorithms, and Applications for Large Gr...
The Power of Motif Counting Theory, Algorithms, and Applications for Large Gr...
 
Database , 4 Data Integration
Database , 4 Data IntegrationDatabase , 4 Data Integration
Database , 4 Data Integration
 
Data structures assignmentweek4b.pdfCI583 Data Structure
Data structures assignmentweek4b.pdfCI583 Data StructureData structures assignmentweek4b.pdfCI583 Data Structure
Data structures assignmentweek4b.pdfCI583 Data Structure
 
Parallel kmeans clustering in Erlang
Parallel kmeans clustering in ErlangParallel kmeans clustering in Erlang
Parallel kmeans clustering in Erlang
 
Query Optimization - Brandon Latronica
Query Optimization - Brandon LatronicaQuery Optimization - Brandon Latronica
Query Optimization - Brandon Latronica
 
Efficient Query Processing in Web Search Engines
Efficient Query Processing in Web Search EnginesEfficient Query Processing in Web Search Engines
Efficient Query Processing in Web Search Engines
 
Visualizing botnets with t-SNE
Visualizing botnets with t-SNEVisualizing botnets with t-SNE
Visualizing botnets with t-SNE
 
IJSETR-VOL-3-ISSUE-12-3358-3363
IJSETR-VOL-3-ISSUE-12-3358-3363IJSETR-VOL-3-ISSUE-12-3358-3363
IJSETR-VOL-3-ISSUE-12-3358-3363
 
MapReduceAlgorithms.ppt
MapReduceAlgorithms.pptMapReduceAlgorithms.ppt
MapReduceAlgorithms.ppt
 
Planet
PlanetPlanet
Planet
 
Os8
Os8Os8
Os8
 
Distributed Decision Tree Induction
Distributed Decision Tree InductionDistributed Decision Tree Induction
Distributed Decision Tree Induction
 
Hadoop Map Reduce OS
Hadoop Map Reduce OSHadoop Map Reduce OS
Hadoop Map Reduce OS
 
Advanced Non-Relational Schemas For Big Data
Advanced Non-Relational Schemas For Big DataAdvanced Non-Relational Schemas For Big Data
Advanced Non-Relational Schemas For Big Data
 
Ch13
Ch13Ch13
Ch13
 
Memory unmanglement
Memory unmanglementMemory unmanglement
Memory unmanglement
 

More from Ali Usman

Cisco Packet Tracer Overview
Cisco Packet Tracer OverviewCisco Packet Tracer Overview
Cisco Packet Tracer OverviewAli Usman
 
Islamic Arts and Architecture
Islamic Arts and  ArchitectureIslamic Arts and  Architecture
Islamic Arts and ArchitectureAli Usman
 
Database , 17 Web
Database , 17 WebDatabase , 17 Web
Database , 17 WebAli Usman
 
Database , 15 Object DBMS
Database , 15 Object DBMSDatabase , 15 Object DBMS
Database , 15 Object DBMSAli Usman
 
Database ,14 Parallel DBMS
Database ,14 Parallel DBMSDatabase ,14 Parallel DBMS
Database ,14 Parallel DBMSAli Usman
 
Database , 5 Semantic
Database , 5 SemanticDatabase , 5 Semantic
Database , 5 SemanticAli Usman
 
Database , 1 Introduction
 Database , 1 Introduction Database , 1 Introduction
Database , 1 IntroductionAli Usman
 
Processor Specifications
Processor SpecificationsProcessor Specifications
Processor SpecificationsAli Usman
 
Fifty Year Of Microprocessor
Fifty Year Of MicroprocessorFifty Year Of Microprocessor
Fifty Year Of MicroprocessorAli Usman
 
Discrete Structures lecture 2
 Discrete Structures lecture 2 Discrete Structures lecture 2
Discrete Structures lecture 2Ali Usman
 
Discrete Structures. Lecture 1
 Discrete Structures. Lecture 1  Discrete Structures. Lecture 1
Discrete Structures. Lecture 1 Ali Usman
 
Muslim Contributions in Medicine-Geography-Astronomy
Muslim Contributions in Medicine-Geography-AstronomyMuslim Contributions in Medicine-Geography-Astronomy
Muslim Contributions in Medicine-Geography-AstronomyAli Usman
 
Muslim Contributions in Geography
Muslim Contributions in GeographyMuslim Contributions in Geography
Muslim Contributions in GeographyAli Usman
 
Muslim Contributions in Astronomy
Muslim Contributions in AstronomyMuslim Contributions in Astronomy
Muslim Contributions in AstronomyAli Usman
 
Processor Specifications
Processor SpecificationsProcessor Specifications
Processor SpecificationsAli Usman
 
Ptcl modem (user manual)
Ptcl modem (user manual)Ptcl modem (user manual)
Ptcl modem (user manual)Ali Usman
 
Nimat-ul-ALLAH shah wali
Nimat-ul-ALLAH shah wali Nimat-ul-ALLAH shah wali
Nimat-ul-ALLAH shah wali Ali Usman
 
Muslim Contributions in Mathematics
Muslim Contributions in MathematicsMuslim Contributions in Mathematics
Muslim Contributions in MathematicsAli Usman
 
Osi protocols
Osi protocolsOsi protocols
Osi protocolsAli Usman
 

More from Ali Usman (19)

Cisco Packet Tracer Overview
Cisco Packet Tracer OverviewCisco Packet Tracer Overview
Cisco Packet Tracer Overview
 
Islamic Arts and Architecture
Islamic Arts and  ArchitectureIslamic Arts and  Architecture
Islamic Arts and Architecture
 
Database , 17 Web
Database , 17 WebDatabase , 17 Web
Database , 17 Web
 
Database , 15 Object DBMS
Database , 15 Object DBMSDatabase , 15 Object DBMS
Database , 15 Object DBMS
 
Database ,14 Parallel DBMS
Database ,14 Parallel DBMSDatabase ,14 Parallel DBMS
Database ,14 Parallel DBMS
 
Database , 5 Semantic
Database , 5 SemanticDatabase , 5 Semantic
Database , 5 Semantic
 
Database , 1 Introduction
 Database , 1 Introduction Database , 1 Introduction
Database , 1 Introduction
 
Processor Specifications
Processor SpecificationsProcessor Specifications
Processor Specifications
 
Fifty Year Of Microprocessor
Fifty Year Of MicroprocessorFifty Year Of Microprocessor
Fifty Year Of Microprocessor
 
Discrete Structures lecture 2
 Discrete Structures lecture 2 Discrete Structures lecture 2
Discrete Structures lecture 2
 
Discrete Structures. Lecture 1
 Discrete Structures. Lecture 1  Discrete Structures. Lecture 1
Discrete Structures. Lecture 1
 
Muslim Contributions in Medicine-Geography-Astronomy
Muslim Contributions in Medicine-Geography-AstronomyMuslim Contributions in Medicine-Geography-Astronomy
Muslim Contributions in Medicine-Geography-Astronomy
 
Muslim Contributions in Geography
Muslim Contributions in GeographyMuslim Contributions in Geography
Muslim Contributions in Geography
 
Muslim Contributions in Astronomy
Muslim Contributions in AstronomyMuslim Contributions in Astronomy
Muslim Contributions in Astronomy
 
Processor Specifications
Processor SpecificationsProcessor Specifications
Processor Specifications
 
Ptcl modem (user manual)
Ptcl modem (user manual)Ptcl modem (user manual)
Ptcl modem (user manual)
 
Nimat-ul-ALLAH shah wali
Nimat-ul-ALLAH shah wali Nimat-ul-ALLAH shah wali
Nimat-ul-ALLAH shah wali
 
Muslim Contributions in Mathematics
Muslim Contributions in MathematicsMuslim Contributions in Mathematics
Muslim Contributions in Mathematics
 
Osi protocols
Osi protocolsOsi protocols
Osi protocols
 

Recently uploaded

Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 

Recently uploaded (20)

Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 

Database , 8 Query Optimization

  • 1. Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/1 Outline • Introduction • Background • Distributed Database Design • Database Integration • Semantic Data Control • Distributed Query Processing ➡ Overview ➡ Query decomposition and localization ➡ Distributed query optimization • Multidatabase Query Processing • Distributed Transaction Management • Data Replication • Parallel Database Systems • Distributed Object DBMS • Peer-to-Peer Data Management • Web Data Management • Current Issues
  • 2. Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/2 Step 3 – Global Query Optimization Input: Fragment query • Find the best (not necessarily optimal) global schedule ➡ Minimize a cost function ➡ Distributed join processing ✦ Bushy vs. linear trees ✦ Which relation to ship where? ✦ Ship-whole vs ship-as-needed ➡ Decide on the use of semijoins ✦ Semijoin saves on communication at the expense of more local processing. ➡ Join methods ✦ nested loop vs ordered joins (merge join or hash join)
  • 3. Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/3 Cost-Based Optimization • Solution space ➡ The set of equivalent algebra expressions (query trees). • Cost function (in terms of time) ➡ I/O cost + CPU cost + communication cost ➡ These might have different weights in different distributed environments (LAN vs WAN). ➡ Can also maximize throughput • Search algorithm ➡ How do we move inside the solution space? ➡ Exhaustive search, heuristic algorithms (iterative improvement, simulated annealing, genetic,…)
  • 4. Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/4 Query Optimization Process Search Space Generation Search Strategy Equivalent QEP Input Query Transformation Rules Cost Model Best QEP
  • 5. Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/5 Search Space • Search space characterized by alternative execution • Focus on join trees • For N relations, there are O(N!) equivalent join trees that can be obtained by applying commutativity and associativity rules SELECT ENAME,RESP FROM EMP, ASG,PROJ WHERE EMP.ENO=ASG.ENO AND ASG.PNO=PROJ.PNO PROJ ASGEMP PROJ ASG EMP PROJ ASG EMP × ▷◁PNO ▷◁ENO ▷◁PNO ▷◁ENO ▷◁ENO,PNO
  • 6. Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/6 Search Space  Restrict by means of heuristics  Perform unary operations before binary operations  …  Restrict the shape of the join tree ➡ Consider only linear trees, ignore bushy ones Linear Join Tree Bushy Join Tree R2R1 R3 R4 R2R1 R4R3 ⋈ ⋈ ⋈ ⋈ ⋈ ⋈
  • 7. Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/7 Search Strategy  How to “move” in the search space.  Deterministic  Start from base relations and build plans by adding one relation at each step  Dynamic programming: breadth-first  Greedy: depth-first  Randomized  Search for optimalities around a particular starting point  Trade optimization time for execution time  Better when > 10 relations  Simulated annealing  Iterative improvement
  • 8. Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/8 Search Strategies • Deterministic R2R1 R3 R4 R2R1 R2R1 R3 R2R1 R3 R3R1 R2 • Randomized ⋈⋈ ⋈ ⋈ ⋈ ⋈ ⋈ ⋈ ⋈ ⋈
  • 9. Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/9 Cost Functions • Total Time (or Total Cost) ➡ Reduce each cost (in terms of time) component individually ➡ Do as little of each cost component as possible ➡ Optimizes the utilization of the resources Increases system throughput • Response Time ➡ Do as many things as possible in parallel ➡ May increase total time because of increased total activity
  • 10. Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/10 Total Cost Summation of all cost factors Total cost = CPU cost + I/O cost + communication cost CPU cost = unit instruction cost no.of instructions I/O cost = unit disk I/O cost no. of disk I/Os communication cost = message initiation + transmission
  • 11. Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/11 Total Cost Factors • Wide area network ➡ Message initiation and transmission costs high ➡ Local processing cost is low (fast mainframes or minicomputers) ➡ Ratio of communication to I/O costs = 20:1 • Local area networks ➡ Communication and local processing costs are more or less equal ➡ Ratio = 1:1.6
  • 12. Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/12 Response Time Elapsed time between the initiation and the completion of a query Response time = CPU time + I/O time + communication time CPU time = unit instruction time * no. of sequential instructions I/O time = unit I/O time * no. of sequential I/Os communication time = unit msg initiation time * no. of sequential msg + unit transmission time * no. of sequential bytes
  • 13. Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/13 Example Assume that only the communication cost is considered Total time = 2 × message initialization time + unit transmission time * (x+y) Response time = max {time to send x from 1 to 3, time to send y from 2 to 3} time to send x from 1 to 3 = message initialization time + unit transmission time * x time to send y from 2 to 3 = message initialization time + unit transmission time * y Site 1 Site 2 x units y units Site 3
  • 14. Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/14 Optimization Statistics • Primary cost factor: size of intermediate relations ➡ Need to estimate their sizes • Make them precise more costly to maintain • Simplifying assumption: uniform distribution of attribute values in a relation
  • 15. Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/15 Statistics • For each relation R[A1, A2, …, An] fragmented as R1, …, Rr ➡ length of each attribute: length(Ai) ➡ the number of distinct values for each attribute in each fragment: card( Ai Rj) ➡ maximum and minimum values in the domain of each attribute: min(Ai), max(Ai) ➡ the cardinalities of each domain: card(dom[Ai]) • The cardinalities of each fragment: card(Rj) Selectivity factor of each operation for relations ➡For joins SF ⋈ (R,S) = card(R ⋈S) card(R) card(S)
  • 16. Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/16 Intermediate Relation Sizes Selection size(R) = card(R) × length(R) card( F(R)) = SF (F) × card(R) where S F (A = value) = card(∏A(R)) 1 S F (A >value) = max(A) – min(A) max(A) – value S F (A <value) = max(A) – min(A) value – max(A) SF (p(Ai) p(Aj)) = SF (p(Ai)) × SF (p(Aj)) SF (p(Ai) p(Aj)) = SF (p(Ai)) + SF (p(Aj)) – (SF (p(Ai)) × SF (p(Aj))) SF (A value}) = SF (A= value) * card({values})
  • 17. Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/17 Intermediate Relation Sizes Projection card( A(R))=card(R) Cartesian Product card(R × S) = card(R) * card(S) Union upper bound: card(R S) = card(R) + card(S) lower bound: card(R S) = max{card(R), card(S)} Set Difference upper bound: card(R–S) = card(R) lower bound: 0
  • 18. Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/18 Intermediate Relation Size Join ➡ Special case: A is a key of R and B is a foreign key of S card(R ⋈A=B S) = card(S) ➡ More general: card(R ⋈ S) = SF⋈ * card(R) × card(S) Semijoin card(R ⋉A S) = SF⋉(S.A) * card(R) where SF⋉(R ⋉A S)= SF⋉(S.A) = card(∏A(S)) card(dom[A])
  • 19. Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/19 Histograms for Selectivity Estimation • For skewed data, the uniform distribution assumption of attribute values yields inaccurate estimations • Use an histogram for each skewed attribute A ➡ Histogram = set of buckets ✦ Each bucket describes a range of values of A, with its average frequency f (number of tuples with A in that range) and number of distinct values d ✦ Buckets can be adjusted to different ranges • Examples ➡ Equality predicate ✦ With (value in Rangei), we have: SF (A = value) = 1/di ➡ Range predicate ✦ Requires identifying relevant buckets and summing up their frequencies
  • 20. Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/20 Histogram Example For ASG.DUR=18: we have SF=1/12 so the card of selection is 300/12 = 25 tuples For ASG.DUR≤18: we have min(range3)=12 and max(range3)=24 so the card. of selection is 100+75+(((18−12)/(24 − 12))*50) = 200 tuples
  • 21. Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/21 Centralized Query Optimization • Dynamic (Ingres project at UCB) ➡ Interpretive • Static (System R project at IBM) ➡ Exhaustive search • Hybrid (Volcano project at OGI) ➡ Choose node within plan
  • 22. Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/22 Dynamic Algorithm  Decompose each multi-variable query into a sequence of mono-variable queries with a common variable  Process each by a one variable query processor ➡ Choose an initial execution plan (heuristics) ➡ Order the rest by considering intermediate relation sizes No statistical information is maintained
  • 23. Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/23 Dynamic Algorithm– Decomposition • Replace an n variable query q by a series of queries q1 q2 … qn where qi uses the result of qi-1. • Detachment ➡ Query q decomposed into q' q" where q' and q" have a common variable which is the result of q' • Tuple substitution ➡ Replace the value of each tuple with actual values and simplify the query q(V1, V2, ... Vn) (q' (t1, V2, V2, ... , Vn), t1 R)
  • 24. Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/24 Detachment q: SELECT V2.A2,V3.A3, …,Vn.An FROM R1 V1, …,Rn Vn WHERE P1(V1.A1 ’)AND P2(V1.A1,V2.A2,…, Vn.An) q': SELECT V1.A1 INTO R1' FROM R1 V1 WHERE P1(V1.A1) q": SELECT V2.A2, …,Vn.An FROM R1' V1, R2 V2, …,Rn Vn WHERE P2(V1.A1, V2.A2, …,Vn.An)
  • 25. Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/25 Detachment Example Names of employees working on CAD/CAM project q1:SELECT EMP.ENAME FROM EMP, ASG, PROJ WHERE EMP.ENO=ASG.ENO AND ASG.PNO=PROJ.PNO AND PROJ.PNAME="CAD/CAM" q11: SELECT PROJ.PNO INTO JVAR FROM PROJ WHERE PROJ.PNAME="CAD/CAM" q': SELECT EMP.ENAME FROM EMP,ASG,JVAR WHERE EMP.ENO=ASG.ENO AND ASG.PNO=JVAR.PNO
  • 26. Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/26 Detachment Example (cont’d) q': SELECT EMP.ENAME FROM EMP,ASG,JVAR WHERE EMP.ENO=ASG.ENO AND ASG.PNO=JVAR.PNO q12: SELECT ASG.ENO INTO GVAR FROM ASG,JVAR WHERE ASG.PNO=JVAR.PNO q13: SELECT EMP.ENAME FROM EMP,GVAR WHERE EMP.ENO=GVAR.ENO
  • 27. Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/27 Tuple Substitution q11 is a mono-variable query q12 and q13 is subject to tuple substitution Assume GVAR has two tuples only: 〈E1〉 and 〈E2〉 Then q13 becomes q131: SELECT EMP.ENAME FROM EMP WHERE EMP.ENO="E1" q132: SELECT EMP.ENAME FROM EMP WHERE EMP.ENO="E2"
  • 28. Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/28 Static Algorithm  Simple (i.e., mono-relation) queries are executed according to the best access path  Execute joins ➡ Determine the possible ordering of joins ➡ Determine the cost of each ordering ➡ Choose the join ordering with minimal cost
  • 29. Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/29 Static Algorithm For joins, two alternative algorithms : • Nested loops for each tuple of external relation (cardinality n1) for each tuple of internal relation (cardinality n2) join two tuples if the join predicate is true end end ➡ Complexity: n1* n2 • Merge join sort relations merge relations ➡ Complexity: n1+ n2 if relations are previously sorted and equijoin
  • 30. Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/30 Static Algorithm – Example Names of employees working on the CAD/CAM project Assume ➡ EMP has an index on ENO, ➡ ASG has an index on PNO, ➡ PROJ has an index on PNO and an index on PNAME PNOENO PROJ ASG EMP
  • 31. Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/31 Example (cont’d)  Choose the best access paths to each relation ➡ EMP: sequential scan (no selection on EMP) ➡ ASG: sequential scan (no selection on ASG) ➡ PROJ: index on PNAME (there is a selection on PROJ based on PNAME)  Determine the best join ordering ➡ EMP ▷◁ASG ▷◁PROJ ➡ ASG ▷◁PROJ ▷◁EMP ➡ PROJ ▷◁ASG ▷◁EMP ➡ ASG ▷◁EMP ▷◁PROJ ➡ EMP × PROJ ▷◁ASG ➡ PRO × JEMP ▷◁ASG ➡ Select the best ordering based on the join costs evaluated according to the two methods
  • 32. Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/32 Static Algorithm Best total join order is one of ((ASG ⋈ EMP) ⋈ PROJ) ((PROJ ⋈ ASG) ⋈ EMP) ASGEMP PROJ EMP × PROJ pruned PROJ × EMP pruned Alternatives EMP ⋈ ASG pruned (ASG ⋈ EMP) ⋈ PROJ ASG ⋈ EMP ASG ⋈ PROJ pruned PROJ ⋈ ASG (PROJ ⋈ ASG) ⋈ EMP
  • 33. Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/33 Static Algorithm • ((PROJ ⋈ ASG) ⋈ EMP) has a useful index on the select attribute and direct access to the join attributes of ASG and EMP • Therefore, chose it with the following access methods: ➡ select PROJ using index on PNAME ➡ then join with ASG using index on PNO ➡ then join with EMP using index on ENO
  • 34. Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/34 Hybrid optimization • In general, static optimization is more efficient than dynamic optimization ➡ Adopted by all commercial DBMS • But even with a sophisticated cost model (with histograms), accurate cost prediction is difficult • Example ➡ Consider a parametric query with predicate WHERE R.A = $a /* $a is a parameter ➡ The only possible assumption at compile time is uniform distribution of values • Solution: Hybrid optimization ➡ Choose-plan done at runtime, based on the actual parameter binding
  • 35. Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/35 Hybrid Optimization Example $a=A $a=A
  • 36. Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/36 Join Ordering in Fragment Queries • Ordering joins ➡ Distributed INGRES ➡ System R* ➡ Two-step • Semijoin ordering ➡ SDD-1
  • 37. Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/37 Join Ordering • 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 R if size(R) < size(S) if size(R) > size(S) S • Consider two relations only
  • 38. Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/38 Join Ordering – Example Consider PROJ ⋈PNO ASG ⋈ENO EMP Site 2 Site 3Site 1 PNOENO PROJ ASG EMP
  • 39. Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/39 Join Ordering – Example Execution alternatives: 1. EMP Site 2 2. ASG Site 1 Site 2 computes EMP'=EMP ⋈ ASG Site 1 computes EMP'=EMP⋈ ASG EMP' Site 3 EMP' Site 3 Site 3 computes EMP' ⋈ PROJ Site 3 computes EMP’ ⋈ PROJ 3. ASG Site 3 4. PROJ Site 2 Site 3 computes ASG'=ASG ⋈ PROJ Site 2 computes PROJ'=PROJ ⋈ ASG ASG' Site 1 PROJ' Site 1 Site 1 computes ASG' ▷◁EMP Site 1 computes PROJ' ⋈ EMP 5. EMP Site 2 PROJ Site 2 Site 2 computes EMP ⋈ PROJ ⋈ ASG
  • 40. Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/40 Semijoin Algorithms • Consider the join of two relations: ➡ R[A] (located at site 1) ➡ S[A](located at site 2) • Alternatives: 1. Do the join R ⋈AS 2. Perform one of the semijoin equivalents R⋈AS (R ⋉AS) ⋈AS R ⋈A (S ⋉A R) (R ⋉A S) ⋈A (S ⋉A R)
  • 41. Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/41 Semijoin Algorithms • Perform the join ➡ send R to Site 2 ➡ Site 2 computes R ⋈A S • Consider semijoin (R ⋉AS) ⋈AS ➡ S' = A(S) ➡ S' Site 1 ➡ Site 1 computes R' = R ⋉AS' ➡ R' Site 2 ➡ Site 2 computes R' ⋈AS Semijoin is better if size( A(S)) + size(R ⋉AS)) < size(R)
  • 42. Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/42 Distributed Dynamic Algorithm 1. Execute all monorelation queries (e.g., selection, projection) 2. Reduce the multirelation query to produce irreducible subqueries q1 q2 … qnsuch that there is only one relation between qi and qi+1 1. Choose qi involving the smallest fragments to execute (call MRQ') 2. Find the best execution strategy for MRQ' a) Determine processing site b) Determine fragments to move 3. Repeat 3 and 4
  • 43. Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/43 Static Approach • Cost function includes local processing as well as transmission • Considers only joins • “Exhaustive” search • Compilation • Published papers provide solutions to handling horizontal and vertical fragmentations but the implemented prototype does not
  • 44. Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/44 Static Approach – Performing Joins • Ship whole ➡ Larger data transfer ➡ Smaller number of messages ➡ Better if relations are small • Fetch as needed ➡ Number of messages = O(cardinality of external relation) ➡ Data transfer per message is minimal ➡ Better if relations are large and the selectivity is good
  • 45. Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/45 Static Approach – Vertical Partitioning & Joins 1. Move outer relation tuples to the site of the inner relation (a) Retrieve outer tuples (b) Send them to the inner relation site (c) Join them as they arrive Total Cost = cost(retrieving qualified outer tuples) + no. of outer tuples fetched * cost(retrieving qualified inner tuples) + msg. cost * (no. outer tuples fetched * avg. outer tuple size)/msg. size
  • 46. Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/46 Static Approach – Vertical Partitioning & Joins 2. Move inner relation to the site of outer relation Cannot join as they arrive; they need to be stored Total cost = cost(retrieving qualified outer tuples) + no. of outer tuples fetched * cost(retrieving matching inner tuples from temporary storage) + cost(retrieving qualified inner tuples) + cost(storing all qualified inner tuples in temporary storage) + msg. cost * no. of inner tuples fetched * avg. inner tuple size/msg. size
  • 47. Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/47 Static Approach – Vertical Partitioning & Joins 3. Move both inner and outer relations to another site Total cost = cost(retrieving qualified outer tuples) + cost(retrieving qualified inner tuples) + cost(storing inner tuples in storage) + msg. cost × (no. of outer tuples fetched * avg. outer tuple size)/msg. size + msg. cost * (no. of inner tuples fetched * avg. inner tuple size)/msg. size + no. of outer tuples fetched * cost(retrieving inner tuples from temporary storage)
  • 48. Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/48 Static Approach – Vertical Partitioning & Joins 4.Fetch inner tuples as needed (a) Retrieve qualified tuples at outer relation site (b) Send request containing join column value(s) for outer tuples to inner relation site (c) Retrieve matching inner tuples at inner relation site (d)Send the matching inner tuples to outer relation site (e) Join as they arrive Total Cost = cost(retrieving qualified outer tuples) + msg. cost * (no. of outer tuples fetched) + no. of outer tuples fetched * no. of inner tuples fetched * avg. inner tuple size * msg. cost / msg. size) + no. of outer tuples fetched * cost(retrieving matching inner tuples for one outer value)
  • 49. Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/49 Dynamic vs. Static vs Semijoin • Semijoin ➡ SDD1 selects only locally optimal schedules • Dynamic and static approaches have the same advantages and drawbacks as in centralized case ➡ But the problems of accurate cost estimation at compile-time are more severe ✦ More variations at runtime ✦ Relations may be replicated, making site and copy selection important • Hybrid optimization ➡ Choose-plan approach can be used ➡ 2-step approach simpler
  • 50. Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/50 2-Step Optimization 1. At compile time, generate a static plan with operation ordering and access methods only 2. At startup time, carry out site and copy selection and allocate operations to sites
  • 51. Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/51 2-Step – Problem Definition • Given ➡ A set of sites S = {s1, s2, …,sn} with the load of each site ➡ A query Q ={q1, q2, q3, q4} such that each subquery qi is the maximum processing unit that accesses one relation and communicates with its neighboring queries ➡ For each qi in Q, a feasible allocation set of sites Sq={s1, s2, …,sk} where each site stores a copy of the relation in qi • The objective is to find an optimal allocation of Q to S such that ➡ the load unbalance of S is minimized ➡ The total communication cost is minimized
  • 52. Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/52 2-Step Algorithm • For each q in Q compute load (Sq) • While Q not empty do 1. Select subquery a with least allocation flexibility 2. Select best site b for a (with least load and best benefit) 3. Remove a from Q and recompute loads if needed
  • 53. Distributed DBMS © M. T. Özsu & P. Valduriez Ch.8/53 2-Step Algorithm Example • Let Q = {q1, q2, q3, q4} where q1 is associated with R1, q2 is associated with R2 joined with the result of q1, etc. • Iteration 1: select q4, allocate to s1, set load(s1)=2 • Iteration 2: select q2, allocate to s2, set load(s2)=3 • Iteration 3: select q3, allocate to s1, set load(s1) =3 • Iteration 4: select q1, allocate to s3 or s4 Note: if in iteration 2, q2, were allocated to s4, this would have produced a better plan. So hybrid optimization can still miss optimal plans