Bug #101510 Documentation about when hash join can be used could be more specific
Submitted: 8 Nov 2020 19:02 Modified: 11 Nov 2020 0:19
Reporter: Mark Callaghan Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Documentation Severity:S3 (Non-critical)
Version:8.0.22 OS:Any
Assigned to: Jon Stephens CPU Architecture:Any

[8 Nov 2020 19:02] Mark Callaghan
Description:
The docs state:
"Beginning with MySQL 8.0.18, MySQL employs a hash join for any query for which each join has an equi-join condition and uses no indexes, such as this one:"

That statement isn't clear. A hash join is possible when no indexes exist that could be used for a join. If there are indexes that can be used for single-table predicates, then hash join is still possible.

https://dev.mysql.com/doc/refman/8.0/en/hash-joins.html

One of your blog posts makes the same claim as I do:
"In general, hash join will be used if you are joining together tables using one or more equi-join conditions, and there are no indexes available for the join conditions. If an index is available, MySQL tends to favor nested loop with index lookup instead."

https://mysqlserverteam.com/hash-join-in-mysql-8/

How to repeat:
Read the docs and blog post
[9 Nov 2020 3:29] MySQL Verification Team
Hello Mark,

Thank you for the report and feedback!

Thanks,
Umesh
[11 Nov 2020 0:19] Jon Stephens
Fixed in mysqldoc rev 67998, mysql-relnotes rev 21389.

Closed.