Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-32659

EXPLAIN output shows possible_keys to be NULL and key to be some key

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.4.32, 11.3(EOL)
    • 10.4(EOL)
    • Optimizer
    • 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

      Attachments

        Activity

          People

            Unassigned Unassigned
            ycp Yuchen Pei
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.