Presentation is loading. Please wait.

Presentation is loading. Please wait.

Choosing an Order for Joins Sean Gilpin ID: 119 CS 257 Section 1.

Similar presentations


Presentation on theme: "Choosing an Order for Joins Sean Gilpin ID: 119 CS 257 Section 1."— Presentation transcript:

1 Choosing an Order for Joins Sean Gilpin ID: 119 CS 257 Section 1

2 Significance of Left and Right Join Arguments Join methods are asymmetric Assumptions are made about which argument is smaller Assumptions are made about which argument has the index

3 Join Trees Each algorithm works best if the left argument is smaller With two relations there are only two choices for the left argument. With more than two relations each possible join tree represents a on ordering for the individual joins.

4 Left-Deep Join Trees A binary tree is left deep if all right children are leaves We will only consider left deep trees to reduce the number of total trees considered. Left deep trees interact well with common join algorithms

5 Dynamic Programming to Select a Join Order and Grouping To pick an order for the join of many relations there are three choices – Consider them all – Consider a subset – Use a heuristic to pick one Use Dynamic Programming to enumerate trees

6 Dynamic Programming to Select a Join Order and Grouping Construct a table with an entry for each subset of one or more of the n relations. In each cell put the estimated size of the join of these relations. The construction of this table is an induction on the subset size.

7 Dynamic Programming With More Detailed Cost Functions Using relation size as the cost estimate simplifies the calculations but has disadvantages. Modify the dynamic programming algorithm to take the join algorithms used into account. Another options is to modify the dynamic programming algorithm based on Selinger- style optimization.

8 A Greedy Algorithm for Selecting a Join Order Although dynamic programming reduces the number of choices, there are still an exponential number of them. So can only use dynamic programming for a small amount of relations. For larger number of relations we will need to use a heuristic such as a greedy algorithm.


Download ppt "Choosing an Order for Joins Sean Gilpin ID: 119 CS 257 Section 1."

Similar presentations


Ads by Google