Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Does the join order matter in Oracle hash joins?

user-3lsyfJun 25 2023

Hi. I have a question about hash join — Does the join order matter in Oracle hash joins?

As far as I know, in hash joins, one table is used as a build table and the other as a probe table.

Unless the leading hint is used (AFAIK, the first table in the leading hint is the build table), the join order does not seem to affect the hash join.

For example, when the join order is A->B, the B table can be the build table, but A may be the probe table, or vice versa.

Whatever the join order, the build table appears to be at the top and the probe table appears at the bottom in the execution plan.

It seems to me that whatever the join order is, it only matters which table is set as the build table and which is set as the probe table.

In summary, I wonder what the join order means in hash joins. Could it be one of the major factors affecting the performance of the join?

(This question is likely to apply to the sort merge join too)

This post has been answered by user9540031 on Jun 25 2023
Jump to Answer
Comments
Post Details
Added on Jun 25 2023
7 comments
1,992 views