首页 > 数据库技术 > 详细

oracle 数据库中几种连接方式执行过程(nested loop、hash join、sort order join)

时间:2014-01-21 23:27:53      阅读:524      评论:0      收藏:0      [点我收藏+]
简单介绍了一下oracle 各种连接方式的执行过程,伪代码内容来源于pro oracle sql。

nested loop:

select empno, ename, dname, loc
from emp, dept
where emp.deptno = dept.deptno


for each row in (select empno, ename, deptno from emp) loop
  for (select dname, loc from dept where deptno =   outer.deptno) loop
    If match then pass the row on to the next step
    If inner join and no match then discard the row
    If outer join and no match set inner column values to null
    and pass the row on to the next step
  end loop
end loop

bubuko.com,布布扣


sort-merge join :

select empno, ename, dname, loc
from emp, dept
where emp.deptno = dept.deptno


select empno, ename, deptno from emp order by deptno
select dname, loc, deptno from dept order by deptno
compare the rowsets and return rows where deptno in both lists match
for an outer join, compare the rowsets and return all rows from the first list
setting column values for the other table to null

bubuko.com,布布扣


hash-join :

select empno, ename, dname, loc
from emp, dept
where emp.deptno = dept.deptno


determine the smaller row set, or in the case of an outer join,
use the outer joined table
select dname, loc, deptno from dept
hash the deptno column and build a hash table
select empno, ename, deptno from emp
hash the deptno column and probe the hash table
if match made, check bitmap to confirm row match
if no match made, discard the row


bubuko.com,布布扣



如需转载,请注明出处:http://blog.csdn.net/renfengjun/article/details/18599161

oracle 数据库中几种连接方式执行过程(nested loop、hash join、sort order join)

原文:http://blog.csdn.net/renfengjun/article/details/18599161

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!