什么时候应该使用INNER -LOOP- JOIN而不是INNER JOIN [英] When should I use an INNER -LOOP- JOIN instead of an INNER JOIN

查看:624
本文介绍了什么时候应该使用INNER -LOOP- JOIN而不是INNER JOIN的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

今天,我了解了SQL Server中称为

Today I learned about a thing in SQL Server called INNER LOOP JOIN.

这是什么意思? (谷歌没有帮助..或者我应该说...有关它的博客文章有些..技术性,令人震惊.)

What does this mean? (Google is not helping .. or should I say ... the blog posts about it are a bit .. technical and are blowing my mind).

此外,在标准INNER JOIN上使用INNER LOOP JOIN的一些常见方案是一个好主意吗?

Also, what are some common scenarios that would be a good idea to use an INNER LOOP JOIN over a standard INNER JOIN?

推荐答案

LOOP |哈希| MERGE是联接提示,指定查询中的联接应使用循环,哈希或合并.使用LOOP | HASH | MERGE JOIN强制两个表之间的特定联接.不能与RIGHT或FULL一起指定LOOP作为联接类型.

LOOP | HASH | MERGE are Join hints, specifying that the join in the query should use looping, hashing, or merging. Using LOOP |HASH | MERGE JOIN enforces a particular join between two tables. LOOP cannot be specified together with RIGHT or FULL as a join type.

您应该始终使用INNER JOIN.让查询优化器决定是否要进行LOOP,MERGE或HASH连接.在几乎所有情况下,优化器都会做出更好的判断.从我的演示文稿中可以找到将要使用的哪个以及何时使用 http://sqlbits.com/Sessions/Event4/谅解_Graphical_Execution_Plans .

You should always use INNER JOIN. Let the query optimizer decide whether it wants to do a LOOP, MERGE, or HASH join. In almost all cases the optimizer will make a better judgement. Which one will be used and when can be found from my presentation http://sqlbits.com/Sessions/Event4/Understanding_Graphical_Execution_Plans.

这篇关于什么时候应该使用INNER -LOOP- JOIN而不是INNER JOIN的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆