MySQL 在 8.0.18 支持了 hash join,这个版本中只支持 join 的等值条件。此时是以 hash join 是以等值条件做 hash table,再进行匹配( build 和 probe )。
MySQL 8.0.20 后就不再限制等值条件了,那这个版本中是怎么进行 build 和 probe 的呢?
例如官方文档中: ··· mysql> EXPLAIN FORMAT=TREE SELECT * FROM t1 JOIN t2 ON t1.c1 < t2.c1\G *************************** 1. row *************************** EXPLAIN: -> Filter: (t1.c1 < t2.c1) (cost=4.70 rows=12) -> Inner hash join (no condition) (cost=4.70 rows=12) -> Table scan on t2 (cost=0.08 rows=6) -> Hash -> Table scan on t1 (cost=0.85 rows=6) ···
https://dev.mysql.com/doc/refman/8.0/en/hash-joins.html
https://mysqlserverteam.com/hash-join-in-mysql-8/