help wantedsig/plannertype/enhancement
Description
Development Task
mysql> create table t (a int, b int, index(a));
Query OK, 0 rows affected (0.03 sec)
mysql> explain select b from t order by a limit 5;
+------------------------------------+---------+-----------+---------------------+-----------------------------------+
| id | estRows | task | access object | operator info |
+------------------------------------+---------+-----------+---------------------+-----------------------------------+
| Projection_7 | 5.00 | root | | test.t.b |
| └─Projection_23 | 5.00 | root | | test.t.a, test.t.b |
| └─IndexLookUp_22 | 5.00 | root | | limit embedded(offset:0, count:5) |
| ├─Limit_21(Build) | 5.00 | cop[tikv] | | offset:0, count:5 |
| │ └─IndexFullScan_19 | 5.00 | cop[tikv] | table:t, index:a(a) | keep order:true, stats:pseudo |
| └─TableRowIDScan_20(Probe) | 5.00 | cop[tikv] | table:t | keep order:false, stats:pseudo |
+------------------------------------+---------+-----------+---------------------+-----------------------------------+
6 rows in set (0.00 sec)
As shown above, the double-projection is confused and unnecessary, so it's better to merge them into one.