Mysql连接方法之嵌套循环和块嵌套循环

1、嵌套循环-nested loop

当两个结果集做合并,需要找出两个结果集中都满足同一个或多个条件的数据时,就需要使用合适的方法来找出满足条件的行。
嵌套循环是集合连接中常见的一种连接方法。通常分为外部循环和内部循环,外部循环的集合称为驱动集合,内部循环的集合称为被驱动集合。
嵌套循环伪代码:

for each row in t1 matching range { for each row in t2 matching reference key { if row satisfies join conditions, send to client } }