26.10.2014 Views

Acyclic Joins

Acyclic Joins

Acyclic Joins

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

A full reducer for S is built “from the inside out.”<br />

1. The empty semijoin program is a full reducer for {T }.<br />

2. A full reducer for {S, T } is given by<br />

T := T ⋉ S;<br />

S := S ⋉ T ;<br />

3. A full reducer for {R, S, T } is given by<br />

S := S ⋉ R;<br />

T := T ⋉ S;<br />

S := S ⋉ T ;<br />

R := R ⋉ S;<br />

7 Order of <strong>Joins</strong><br />

Let S be an acyclic database schema. Suppose we have applied a full reducer. We must now join all<br />

relations. Suppose we have removed S 1 , S 2 , . . . , S n in that order. That is, S 1 was the first ear removed,<br />

S 2 was the second ear removed, and so on. Assume that for i ∈ {1, . . . , n − 1}, S i was removed in favor<br />

of T i ∈ {S i+1 , . . . , S n }. In particular, T n−1 = S n . The full reducer in the proof of Theorem 2 is the<br />

following.<br />

T 1 := T 1 ⋉ S 1<br />

T 2 := T 2 ⋉ S 2<br />

.<br />

T n−1 := T n−1 ⋉ S n−1<br />

S n−1 := S n−1 ⋉ T n−1<br />

.<br />

S i := S i ⋉ T i<br />

.<br />

S 2 := S 2 ⋉ T 2<br />

S 1 := S 1 ⋉ T 1<br />

Now we join relations in reverse order, that is,<br />

Result := S n<br />

Result := S n−1 ✶ Result<br />

Result := S n−2 ✶ Result<br />

.<br />

Result := S i ✶ Result<br />

.<br />

Result := S 1 ✶ Result<br />

We argue that the size of Result cannot decrease. When we join S i to S i+1 ✶ · · · ✶ S n , we know that every<br />

tuple of S i joins with some tuple of S i+1 ✶ · · · ✶ S n , because the command S i := S i ⋉ T i in the full reducer<br />

6

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

Saved successfully!

Ooh no, something went wrong!