概述
Leading(): 指示Oracle在执行join(hash join, nested loop join, merge join)时的连接顺序。
当执行计划不按照最优的表连接顺序时,考虑使用Leading 改变执行计划。 使用leading 的目的是减少检索数据量, 提高查询性能。
eg:
select v.*, t.* from v_view1 join (select /*+ leading(t1, tftc) */ * from tftc, t1 where t1.id=tftc.id) t
on v.id=t.id and v.name=t.name left join t2 on t2.name=v.name
;
LEADING Hint
![Description of leading_hint.gif follows Description of leading_hint.gif follows](https://file2.kaopuke.com:8081/files_image/2023060717/202306071722073878329.gif)
Description of the illustration leading_hint.gif
(See "Specifying a Query Block in a Hint", tablespec::=)
The LEADING
hint instructs the optimizer to use the specified set of tables as the prefix in the execution plan. This hint is more versatile than the ORDERED
hint. For example:
SELECT /*+ LEADING(e j) */ * FROM employees e, departments d, job_history j WHERE e.department_id = d.department_id AND e.hire_date = j.start_date;
The LEADING
hint is ignored if the tables specified cannot be joined first in the order specified because of dependencies in the join graph. If you specify two or more conflicting LEADING
hints, then all of them are ignored. If you specify the ORDERED
hint, it overrides all LEADING
hints.
最后
以上就是陶醉黑夜为你收集整理的Oracle hint Leading 的使用的全部内容,希望文章能够帮你解决Oracle hint Leading 的使用所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复