Help Center > > Developer Guide> Query Performance Optimization> Tuning Queries> Hint-based Tuning> Join Operation Hints

Join Operation Hints

Updated at: Jul 15, 2020 GMT+08:00

Function

Specifies the join method. It can be nested loop join, hash join, or merge join.

Syntax

1
[no] nestloop|hashjoin|mergejoin(table_list)

Parameter Description

  • no indicates that the specified hint will not be used for a join.
  • table_list specifies the tables to be joined. The values are the same as those of join_table_list but contain no parentheses.

For example:

no nestloop(t1 t2 t3): nestloop is not used for joining t1, t2, and t3. The three tables may be joined in either of the two ways: Join t2 and t3, and then t1; join t1 and t2, and then t3. This hint takes effect only for the last join. If necessary, you can hint other joins. For example, you can add no nestloop(t2 t3) to join t2 and t3 first and to forbid the use of nestloop.

Examples

Hint the query plan in Examples as follows:

1
2
explain
select /*+ nestloop(store_sales store_returns item) */ i_product_name product_name ...

nestloop is used for the last join between store_sales, store_returns, and item. The optimized plan is as follows:

Did you find this page helpful?

Submit successfully!

Thank you for your feedback. Your feedback helps make our documentation better.

Failed to submit the feedback. Please try again later.

Which of the following issues have you encountered?







Please complete at least one feedback item.

Content most length 200 character

Content is empty.

OK Cancel