[MDEV-32659] EXPLAIN output shows possible_keys to be NULL and key to be some key Created: 2023-11-02  Updated: 2023-11-02

Status: Open
Project: MariaDB Server
Component/s: Optimizer
Affects Version/s: 11.3, 10.4.32
Fix Version/s: 10.4, 11.3

Type: Bug Priority: Major
Reporter: Yuchen Pei Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None


 Description   

Noticed when working on MDEV-27576 on a 11.3 based commit. Not sure if it is intended

create or replace table t (a int, key(a asc)) engine=innodb;
insert into t select seq * 2 from seq_1_to_100 order by rand(1);
explain select max(200 - a) from t;
| id | select_type | table | type  | possible_keys | key | key_len | ref  | rows | Extra       |
|  1 | SIMPLE      | t     | index | NULL          | a   |       5 | NULL |  100 | Using index |
select max(200 - a) from t;
max(200 - a)
198
explain select min(200 - a) from t;
| id | select_type | table | type  | possible_keys | key | key_len | ref  | rows | Extra       |
|  1 | SIMPLE      | t     | index | NULL          | a   |       5 | NULL |  100 | Using index |
select min(200 - a) from t;
min(200 - a)
0

h/t danblack for spotting it


Generated at Thu Feb 08 10:33:01 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.