Using the LEADING Hint

LEADING Hint

The LEADING hint can be used with more than one table or view. It forces the optimizer to use the the tables or views to be joined in the order specified in the hint. The first table specified is used to start the join.

This hint preferred over the ORDERED hint as it provides more flexibility. For example:

Example

SELECT /*+ LEADING(a b) */ *
  FROM MyTab1 a, MyTab2 b, MyTab3 c
  WHERE a.col1=b.col1
  AND b.col2 = c.col2
/

Notes
1. The hint is ignored if the tables cannot be joined in the order listed in the hint.
2. If two conflicting hints are used, then they are ignored.
3. The ORDERED hint overrides LEADING hints.


Published 21st February 2023

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License