您的位置:首页 > 其它

执行计划中三种最常用连接方式的伪码实现

2017-08-11 19:51 309 查看
1、NL

for each row R1 in the outer row source

for each row R2 in the inner row soruce

if R1 joins with R2

return (R1, R2)

2、merge

get first row R1 from input 1

get first row R2 from input 2

while not at the end of either input

begin

if R1 joins with R2

begin

output (R1, R2)

get next row R2 from input 2

end

else if R1 < R2

get next row R1 from input 1

else

get next row R2 from input 2

end

3、

for each row R1 in the build row source

begin

calculate hash value on R1 join key(s)

insert R1 into the appropriate hash bucket

end

for each row R2 in the probe row source

begin

calculate hash value on R2 join key(s)

for each row R1 in the corresponding hash bucket

if R1 joins with R2

output (R1, R2)

end
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐