Have you ever tried to use a join hint (e.g., USE_NL, or USE_HASH) in a query, only to realize that the query optimizer stubbornly refuses to obey?
No matter how frustrating this might be for you, there is an explanation for this behavior. One of the main reasons for such an event is the following rule:
Oracle first decides on the join order and then on the join method to use.
No matter how frustrating this might be for you, there is an explanation for this behavior. One of the main reasons for such an event is the following rule:
Oracle first decides on the join order and then on the join method to use.
In this post, we will describe how join ordering can be the reason for the optimizer to ignore a hint for forcing a specific join method (e.g., nested loops, hash join, sort merge join etc.) Moreover, we will show how one can use the USE_NL or USE_HASH hints (or any hint that forces a specific join method) in combination with the LEADING (or ORDERED) hint (i.e., hints that force a specific join order).