在线精品99_中国九九盗摄偷拍偷看_91免费版在线观看_91.app_91高清视频在线_99热最新网站

数据库中表连接方式有哪些

108次阅读
没有评论

共计 1843 个字符,预计需要花费 5 分钟才能阅读完成。

这篇文章将为大家详细讲解有关数据库中表连接方式有哪些,丸趣 TV 小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。

1 nested loop join

循环嵌套连接:行源 1 的每一条记录,依次去匹配行源 2 的每条记录,将符合连接条件的记录放在结果集中,直到行源 1 的所有记录都完成这个操作。循环嵌套连接是最基本也是最古老的表连接方式。

2 sort merge join

排序合并连接:行源 1 和行源 2 的数据分别排序,然后将两个排序的源表合并,符合连接条件的记录放到结果集中。由于排序需要内存空间,sort merge join 对内存有比较大的消耗,如果内存空间 (8i 为 sort_area_size,9i 及以上使用 PGA) 不足,则会使用临时表空间,这样会降低排序合并连接的效率。排序合并连接是最古老的表连接方式之一。

 

附上 tom 哥哥的解释:

You Asked 
Tom,

What is the difference between Sort Merge and Hash Joins. Don t they both do a one
FULL scan each on the joining tables and join them?

I know Sort Merge is used in the case of ALL ROWS and Nested Loops in the case of
FIRST ROWS hints. How about Has Join? When is it used?

Would really appreciate if you could explain it with a couple of examples.

Thanks in advance. 

and we said…
Well, a sort merge of A and B is sort of like this:

   read A and sort by join key to temp_a
   read B and sort by join key to temp_b

   read a record from temp_a
   read a record from temp_b
   while NOT eof on temp_a and temp_b
   loop
     if (temp_a.key = temp_b.key) then output joined record
     elsif (temp_a.key = temp_b.key) read a record from temp_a
     elsif (temp_a.key = temp_b.key) read a record from temp_b )
   end loop

(its more complex then that, the above logic assumed the join key was unique — we really
need to join every match in temp_a to every match in temp_b but you get the picture)

The hash join is conceptually like:

   create a hash table on one of A or B (say A) on the join key creating temp_a.

   while NOT eof on B
     read a record in b
     hash the join key and look up into temp_a by that hash key for matching 
     records
     output the matches
   end loop

So, a hash join can sometimes be much more efficient (one hash, not two sorts)

Hash joins are used any time a sort merge might be used in most cases. If you don t see
hash joins going on, perhaps you have hash_join_enabled turned off…

3  hash join

哈希连接:将行源 1 计算成一张基于连接键的 hash 表,行源 2 的每条记录依次扫描这张 hash 表,找到匹配的记录放到结果集。计算 hash 表需要内存空间,hash join 同样对于内存有比较大的消耗,如果内存空间 (8i 为 hash_area_size,9i 及以上使用 PGA) 不足,则会使用临时表空间,这样会降低哈希连接的效率。

关于“数据库中表连接方式有哪些”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,使各位可以学到更多知识,如果觉得文章不错,请把它分享出去让更多的人看到。

正文完
 
丸趣
版权声明:本站原创文章,由 丸趣 2023-07-19发表,共计1843字。
转载说明:除特殊说明外本站除技术相关以外文章皆由网络搜集发布,转载请注明出处。
评论(没有评论)
主站蜘蛛池模板: 欧美乱妇日本无乱码特黄大片 | 精品一区二区三区电影 | 男女羞羞视频 教学 | 久久久久亚洲精品天堂 | 亚洲综合欧美 | 国产中文字幕乱人伦在线观看 | 武则天黄色片 | 欧美精品久久久亚洲 | 伊人激情久久综合中文字幕 | 中文字幕在线视频免费 | 日本免费一区二区三区 | 亚洲自偷自拍另类图区 | 无码人妻少妇久久中文字幕 | 福利视频秘密网址在线观看 | 欧美一区二区三区gg高清影视 | 曰本无码人妻丰满熟妇啪啪 | 久久婷婷五月综合色国产香蕉 | 日批免费视频不要会员 | 亚洲 欧美 日韩在线 | 色欲av伊人久久大香线蕉影院 | 无码人妻少妇久久中文字幕蜜桃 | 亚洲成人在线电影 | 亚洲精品久久一区二区无卡 | 8ⅹ8x擦拨擦拨成人免费视频 | 一二三四社区在线中文视频 | 欧美成人免费视频www | 欧美一区二区三区免费高 | 成人a毛片免费全部播放 | 久久视频6免费观看视频精品 | 成人国产综合 | 三级4级全黄60分钟 三级aaa黄特色 | 鲁鲁鲁爽爽爽在线视频观看 | 亚洲国产婷婷六月丁香 | 下面一进一出好爽视频 | 国产热视频 | 日本大片免a费观看视频+播放器 | 亚洲全黄 | 91偷偷久久做嫩草电影院 | 中文字幕在线亚洲日韩6页 中文字幕在线一区 | 一级毛片片| 日本丰满少妇bbb |