阅读这篇文章,你将会了解
1.什么是Nested-Loop Join?
2.Index Nested-Loop Join怎么优化连接?
3.Block Nested-Loop Join怎么优化连接?
一.Nested-Loop Join
在Mysql中,使用Nested-Loop Join的算法思想去优化join,Nested-Loop Join翻译成中文则是“嵌套循环连接”。
举个例子:
select * from t1 inner join t2 on t1.id=t2.tid
(1)t1称为外层表,也可称为驱动表。
(2)t2称为内层表,也可称为被驱动表。
//伪代码表示:
List<Row> result = new ArrayList<>(