CHAPTER 10Join Cardinality

What is the maximum number of tables that Oracle can join at once? You may be surprised to learn that the answer is two. It doesn't matter how many tables you have in your query, Oracle will only work on two objects at a time in a join. In fact, you could even argue that the optimizer doesn't have a long-term strategy for joins, it simply takes what it's got at any one point and joins on the next available table to see what happens.

Of course, this description is a little fanciful—but it's not far from the truth. To perform a five-table join, the optimizer picks a starting table and joins on one table; it takes the intermediate result and joins on one more table; it takes the intermediate result ... and so on, until ...

Get Cost-Based Oracle Fundamentals now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.