嵌套循环连接(Nested Loops Joins)

The nested loops join, also called nested iteration, uses one join input as the outer input

table(shown as the top input in the graphical execution plan) and one as the inner (bottom)

input table.The outer loop consumes the outer input table row by row. The inner loop, executed

for each outer row, searches for matching rows in the inner input table.In the simplest case,

the search scans an entire table or index; this is called a naive nested loops join.If the search

exploits an index, it is called an index nested loops join.If the index is built as part of the query

plan (and destroyed upon completion of the query),it is called a temporary index nested loops join.

All these variants are considered by the query optimizer.A nested loops join is particularly effective

if the outer input is quite small and the inner input is preindexed and quite large. In many small

transactions, such as those affecting only a small set of rows, index nested loops joins are far

superior to both merge joins and hash joins.In large queries,however, nested loops joins are

often not the optimal choice.【摘自technet】

嵌套循环连接,也被称作嵌套迭代,用于连接外部输入表(显示为图形执行计划的顶部输入)和内部输入表的输入

。外部循环按照行检索外部输入表。内部循环,执行外部的每一行,查询内部输入表匹配的行。最简单的情况,查

询扫描整个表或者索引;这叫做纯嵌套循环连接。如果查询利用了索引,被称为索引嵌套循环连接。如果索引作为

查询计划的一部分被构建,这被称作临时索引嵌套循环连接。所有这些变体都会被查询优化器考虑到。当外部输入

非常小并且内部输入很大且预先添加过索引的时候嵌套循环连接是非常有效的。在许多小的转换中,比如仅仅影响

很小的行集的情况。索引嵌套连接是远远优于合并连接和哈希连接的。然而,在大数据的查询情况下,嵌套循环连

接通常不是最好的选择。

转载于:https://www.cnblogs.com/ucos/p/3541089.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值