25.01.2015 Views

Cost-Based Optimization of Integration Flows - Datenbanken ...

Cost-Based Optimization of Integration Flows - Datenbanken ...

Cost-Based Optimization of Integration Flows - Datenbanken ...

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

5.2 Horizontal Queue Partitioning<br />

Algorithm 5.2 MFO Plan Rewriting (A-MPR)<br />

Require: operator sequence o, partitioning scheme ba<br />

1: D ← ∅<br />

2: for i ← 1 to |o| do // for each operator o i<br />

3: // Part 1: Dependency Analysis<br />

4: for j ← i to |o| do // for each following operator o j<br />

5:<br />

δ<br />

if ∃o j → oi then // existing data dependency over data object var<br />

6: D ← D ∪ d〈o j , var, o i 〉 with d〈o j , var, o i 〉 ← create dependency<br />

7: // Part 2: Plan Rewriting<br />

8: for k ← 1 to |D| do // for each dependency d<br />

9: d〈o y , q, o x 〉 ← d k<br />

10: if o i ≡ o y then // o i is target <strong>of</strong> data dependency<br />

11: if ba(o y , var) < ba(o x , var) then // o i benefits from lower-level partition<br />

12: o x .insertAfter(o s ) with o s ←createPSlit<br />

13: o y .insertBefore(o iter ) with o iter ←createIteration<br />

14: ba cur ← ba(o y , var)<br />

15: for j ← i to |o| do // for each following operator o j<br />

16: if ba(o j ) = ba cur or ba(o j ) = NULL then<br />

17: o.remove(o j )<br />

18: o iter .insertLast(o j )<br />

19: D.modify(o iter , o j ) // change the old dependencies<br />

20: else if ba(o j ) < ba cur then<br />

21: recursive plan rewriting (lines 12-24)<br />

22: else // ba(o j ) > ba cur<br />

23: o j .insertBefore(o m ) with o m ←createPMerge<br />

24: break<br />

25: return o<br />

o, the derived partitioning scheme ba and the created set <strong>of</strong> dependencies D. For each<br />

operator o i in o, we iterate over all dependencies in D followed by the main rewriting<br />

rules. If the partitioning attribute <strong>of</strong> operator o x (source <strong>of</strong> the data and thus, target<br />

<strong>of</strong> data dependency) is higher than the partitioning attribute <strong>of</strong> the source <strong>of</strong> the data<br />

dependency o y , we insert a PSplit operator as well as an Iteration operator. We then<br />

iterate over all following operators (including o y ) and evaluate if they can be included<br />

into the iteration body by comparing the partitioning attributes with ba(o j ) = ba cur . If<br />

the required level is a lower-level attribute, we recursively invoke the insertion <strong>of</strong> PSplit<br />

and Iteration operators. In contrast, if we determined an operator with a higher-level<br />

attribute, we found the end <strong>of</strong> the current Iteration operator and insert a PMerge operator.<br />

For binary operators (e.g., Join operator), there might be a difference between<br />

partitioning attributes (for one side an Iteration was inserted). In this case, we do not<br />

use a combined iteration but a direct positional lookup at the higher-level partition. A<br />

single PSplit or PMerge operator can bridge multiple levels <strong>of</strong> the partitioning scheme<br />

such that for plan rewriting, the lower, equal, and higher comparison is sufficient.<br />

This algorithm is used whenever the partitioning scheme (derived from the plan) changes<br />

during periodical re-optimization. Thus, although the algorithm is not executed during<br />

each re-optimization step, it might be used during runtime and hence, it is worth to<br />

141

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!