针对leading使用:
10g中对leading做了加强~ 可以直接在后面写多表的连接顺序了,也就是说使用leading不需要from后面的固定顺序了
MYDB@MYDB10G >select
2 /*+
3 leading(t1 t2 t3 t4)
4 use_hash(t2)
5 use_hash(t3)
6 swap_join_inputs(t3)
7 use_hash(t4)
8 no_swap_join_inputs(t4)
9 */ * from t3,t4,t2,t1
10 where t1.object_id=t2.object_id
11 and t2.object_name=t3.object_name
12 and t3.owner=t4.owner
13 and t4.owner='MYDB'
14 /
MYDB@MYDB10G >select
2 /*+
3 leading(t1 t2 t3 t4)
4 use_hash(t2)
5 use_hash(t3)
6 swap_join_inputs(t3)
7 use_hash(t4)
8 no_swap_join_inputs(t4)
9 */ * from t3,t4,t2,t1
10 where t1.object_id=t2.object_id
11 and t2.object_name=t3.object_name
12 and t3.owner=t4.owner
13 and t4.owner='MYDB'
14 /