14.02.2014 Views

Query Processing and Optimization

Query Processing and Optimization

Query Processing and Optimization

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

External Sorting (Multiway Merge Sort)<br />

• Buffer size is n B = 4 (N)<br />

Orginal rel.<br />

32 5 1712 1 14 8 3 3130232629 2 2511 6 7 151628 4 9 221821102013272419<br />

Initial runs<br />

First merge<br />

Second merge<br />

5 121732 1 3 8 14 23263031 2 112529 6 7 1516 4 9 2228 10182021 13192427<br />

1 3 5 8 1214172326303132 2 4 6 7 9 11151622252829 1013181920202427<br />

1 2 3 4 5 6 7 8 9 1011121314151617181920212223242526272829303132<br />

• Cost: 2 × b relation + 2 × b relation ×⎡log nB -1 (b relation /n B )⎤<br />

• 2 × 32 + 2 × 32 × log 3 (32/4) = 192<br />

18

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

Saved successfully!

Ooh no, something went wrong!