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

EXPLAIN EXTENDED does not show condition in HAVING

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Minor
    • Resolution: Unresolved
    • 10.2, 10.3, 10.4, 10.5
    • 10.4, 10.5
    • Optimizer
    • None

    Description

      create table t1 (a int);
      insert into t1 values (1),(2),(1);
      explain extended select a, count(*) c from t1 group by a having c < 2;
      show warnings;
      drop table t1;
      

      10.2 c048053c

      MariaDB [test]> explain extended select a, count(*) c from t1 group by a having c < 2;
      +------+-------------+-------+------+---------------+------+---------+------+------+----------+---------------------------------+
      | id   | select_type | table | type | possible_keys | key  | key_len | ref  | rows | filtered | Extra                           |
      +------+-------------+-------+------+---------------+------+---------+------+------+----------+---------------------------------+
      |    1 | SIMPLE      | t1    | ALL  | NULL          | NULL | NULL    | NULL |    3 |   100.00 | Using temporary; Using filesort |
      +------+-------------+-------+------+---------------+------+---------+------+------+----------+---------------------------------+
      1 row in set, 1 warning (0.091 sec)
       
      MariaDB [test]> show warnings;
      +-------+------+--------------------------------------------------------------------------------------------------+
      | Level | Code | Message                                                                                          |
      +-------+------+--------------------------------------------------------------------------------------------------+
      | Note  | 1003 | select `test`.`t1`.`a` AS `a`,count(0) AS `c` from `test`.`t1` group by `test`.`t1`.`a` having 1 |
      +-------+------+--------------------------------------------------------------------------------------------------+
      1 row in set (0.000 sec)
      

      Note having 1 in the output above.

      10.1 displays the condition:

      10.1 da9081d1

      MariaDB [test]> explain extended select a, count(*) c from t1 group by a having c < 2;
      +------+-------------+-------+------+---------------+------+---------+------+------+----------+---------------------------------+
      | id   | select_type | table | type | possible_keys | key  | key_len | ref  | rows | filtered | Extra                           |
      +------+-------------+-------+------+---------------+------+---------+------+------+----------+---------------------------------+
      |    1 | SIMPLE      | t1    | ALL  | NULL          | NULL | NULL    | NULL |    3 |   100.00 | Using temporary; Using filesort |
      +------+-------------+-------+------+---------------+------+---------+------+------+----------+---------------------------------+
      1 row in set, 1 warning (0.000 sec)
       
      MariaDB [test]> show warnings;
      +-------+------+----------------------------------------------------------------------------------------------------------+
      | Level | Code | Message                                                                                                  |
      +-------+------+----------------------------------------------------------------------------------------------------------+
      | Note  | 1003 | select `test`.`t1`.`a` AS `a`,count(0) AS `c` from `test`.`t1` group by `test`.`t1`.`a` having (`c` < 2) |
      +-------+------+----------------------------------------------------------------------------------------------------------+
      1 row in set (0.000 sec)
      

      The difference appeared in very early 10.2 branch after this merge:

      commit b532be9f8ce4872be4a3f1ef2fa296a1de347859 (HEAD)
      Merge: a4c81986aad 0f62eee2f87
      Author: Sergei Petrunia
      Date:   Tue Apr 12 00:00:53 2016 +0200
       
          Merge ../10.2-window-funcs-r12 into 10.2
      

      Attachments

        Activity

          People

            psergei Sergei Petrunia
            elenst Elena Stepanova
            Votes:
            0 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.