•The query is for a single table, not a join on multiple tables. 

•A single-index FORCE INDEX  index hint is present. The idea is that if index use is forced, there is nothing to be gained from the additional overhead of performing dives into the index. 

•The index is nonunique and not a FULLTEXT  index. 

•No subquery is present. 

•No DISTINCT , GROUP BY , or ORDER BY  clause is present. 

For EXPLAIN FOR CONNECTION , the output changes as follows if index dives are skipped: 

•For traditional output, the rows  and filtered  values are NULL . 

•For JSON output, rows_examined_per_scan  and rows_produced_per_join  do not appear, skip_index_dive_due_to_force  is true , and cost calculations are not accurate. 

Without FOR CONNECTION , EXPLAIN  output does not change when index dives are skipped. 

After execution of a query for which index dives are skipped, the corresponding row in the INFORMATION_SCHEMA.OPTIMIZER_TRACE  table contains an index_dives_for_range_access value of skipped_due_to_force_index . 

## Skip Scan Range Access Method 

Consider the following scenario: 

CREATE TABLE t1 (f1 INT NOT NULL, f2 INT NOT NULL, PRIMARY KEY(f1, f2)); INSERT INTO t1 VALUES (1,1), (1,2), (1,3), (1,4), (1,5), (2,1), (2,2), (2,3), (2,4), (2,5); INSERT INTO t1 SELECT f1, f2 + 5 FROM t1; INSERT INTO t1 SELECT f1, f2 + 10 FROM t1; INSERT INTO t1 SELECT f1, f2 + 20 FROM t1; INSERT INTO t1 SELECT f1, f2 + 40 FROM t1; ANALYZE TABLE t1; EXPLAIN SELECT f1, f2 FROM t1 WHERE f2 > 40; 

To execute this query, MySQL can choose an index scan to fetch all rows (the index includes all columns to be selected), then apply the f2 > 40  condition from the WHERE  clause to produce the final result set. 

A range scan is more efficient than a full index scan, but cannot be used in this case because there is no condition on f1 , the first index column. However, as of MySQL 8.0.13, the optimizer can perform multiple range scans, one for each value of f1 , using a method called Skip Scan that is similar to Loose Index Scan (see Section 8.2.1.17, “GROUP BY Optimization” ): 

1. Skip between distinct values of the first index part, f1  (the index prefix). 

2. Perform a subrange scan on each distinct prefix value for the f2 > 40  condition on the remaining index part. 

For the data set shown earlier, the algorithm operates like this: 

1. Get the first distinct value of the first key part ( f1 = 1 ). 

2. Construct the range based on the first and second key parts ( f1 = 1 AND f2 > 40 ). 

3. Perform a range scan. 

4. Get the next distinct value of the first key part ( f1 = 2 ). 

