Optimizing SELECT Statements •Prior to MySQL 8.0.20, it controls how the optimizer uses the Block Nested Loop join algorithm. •In MySQL 8.0.18 and later, it also controls the use of hash joins (see Section 8.2.1.4, “Hash Join Optimization” ). •Beginning with MySQL 8.0.20, the flag controls hash joins only, and the block nested loop algorithm is no longer supported. The  batched_key_access  flag controls how the optimizer uses the Batched Key Access join algorithms. By default,  block_nested_loop  is  on  and  batched_key_access  is  off . See Section 8.9.2, “Switchable Optimizations” . Optimizer hints may also be applied; see Optimizer Hints for Block Nested- Loop and Batched Key Access Algorithms. For information about semijoin strategies, see Section 8.2.2.1, “Optimizing IN and EXISTS Subquery Predicates with Semijoin Transformations” Block Nested-Loop Algorithm for Outer Joins and Semijoins The original implementation of the MySQL BNL algorithm was extended to support outer join and semijoin operations (and was later superseded by the hash join algorithm; see Section 8.2.1.4, “Hash Join Optimization” ). When these operations are executed with a join buffer, each row put into the buffer is supplied with a match flag. If an outer join operation is executed using a join buffer, each row of the table produced by the second operand is checked for a match against each row in the join buffer. When a match is found, a new extended row is formed (the original row plus columns from the second operand) and sent for further extensions by the remaining join operations. In addition, the match flag of the matched row in the buffer is enabled. After all rows of the table to be joined have been examined, the join buffer is scanned. Each row from the buffer that does not have its match flag enabled is extended by  NULL  complements ( NULL  values for each column in the second operand) and sent for further extensions by the remaining join operations. In MySQL 8.0, the  block_nested_loop  flag of the  optimizer_switch  system variable works as follows: •Prior to MySQL 8.0.20, it controls how the optimizer uses the Block Nested Loop join algorithm. •In MySQL 8.0.18 and later, it also controls the use of hash joins (see Section 8.2.1.4, “Hash Join Optimization” ). •Beginning with MySQL 8.0.20, the flag controls hash joins only, and the block nested loop algorithm is no longer supported. See Section 8.9.2, “Switchable Optimizations” , for more information. Optimizer hints may also be applied; see Optimizer Hints for Block Nested-Loop and Batched Key Access Algorithms. In  EXPLAIN  output, use of BNL for a table is signified when the  Extra  value contains  Using join buffer (Block Nested Loop)  and the  type  value is  ALL ,  index , or  range . For information about semijoin strategies, see Section 8.2.2.1, “Optimizing IN and EXISTS Subquery Predicates with Semijoin Transformations” Batched Key Access Joins MySQL implements a method of joining tables called the Batched Key Access (BKA) join algorithm. BKA can be applied when there is an index access to the table produced by the second join operand. Like the 1673