Bug #49393 optimizer does not report decission (loose index scan) in execution plan

Submitted: 3 Dec 2009 10:08
Reporter: Oli Sennhauser Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Optimizer Severity:S4 (Feature request)
Version:5.1.38 OS:Any
Assigned to: CPU Architecture:Any
Tags: execution plan, loose index scan, Optimizer

[3 Dec 2009 10:08] Oli Sennhauser
Description:
According to our documentation the optimizer can decide under certain circumstances to use an optimization called loose index scan:

  http://dev.mysql.com/doc/refman/5.1/en/loose-index-scan.html

This is NOT reported in the execution plan.

How to repeat:
create table t1 (c1 int, c2 int, c3 int, c4 int, index (c1, c2, c3)) engine Myisam;

insert into t1 values (1,1,1,1), (2,2,2,2), (3,3,3,3);

explain
SELECT MAX(c3), MIN(c3), c1, c2 FROM t1 WHERE c2 > 1 GROUP BY c1, c2;

+----+-------------+-------+-------+---------------+------+---------+------+------+----------+--------------------------+
| id | select_type | table | type  | possible_keys | key  | key_len | ref  | rows | filtered | Extra                    |
+----+-------------+-------+-------+---------------+------+---------+------+------+----------+--------------------------+
|  1 | SIMPLE      | t1    | index | NULL          | c1   | 15      | NULL |    3 |   100.00 | Using where; Using index |
+----+-------------+-------+-------+---------------+------+---------+------+------+----------+--------------------------+

Suggested fix:
+------------------------------------------------+
| Extra                                          |
+------------------------------------------------+
| Using where; Using index(c1, loose index scan) |
+------------------------------------------------+
[20 Oct 2016 16:34] Alexey Kopytov
I guess this was fixed a long time ago. There's now "Using index for group-by" in EXPLAIN output to indicate loose index scan usage.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.049 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.