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

FIXED: Context replay doesn't handle MIN/MAX optimization

    XMLWordPrintable

Details

    Description

      This comes from main.view test failure:

      CREATE TABLE t1 (a int PRIMARY KEY, b int);
      INSERT INTO t1 VALUES (2,20), (3,10), (1,10), (0,30), (5,10);
       
      set optimizer_record_context=1;
      EXPLAIN SELECT MAX(a) FROM t1;
      select context into dumpfile '/tmp/1.sql' from information_schema.optimizer_context;
       
      source /tmp/1.sql
      

      The first EXPLAIN gives:

      MariaDB [test]> EXPLAIN SELECT MAX(a) FROM t1;
      +------+-------------+-------+------+---------------+------+---------+------+------+------------------------------+
      | id   | select_type | table | type | possible_keys | key  | key_len | ref  | rows | Extra                        |
      +------+-------------+-------+------+---------------+------+---------+------+------+------------------------------+
      |    1 | SIMPLE      | NULL  | NULL | NULL          | NULL | NULL    | NULL | NULL | Select tables optimized away |
      +------+-------------+-------+------+---------------+------+---------+------+------+------------------------------+
      

      The second:

      +------+-------------+-------+------+---------------+------+---------+------+------+-------------------------+
      | id   | select_type | table | type | possible_keys | key  | key_len | ref  | rows | Extra                   |
      +------+-------------+-------+------+---------------+------+---------+------+------+-------------------------+
      |    1 | SIMPLE      | NULL  | NULL | NULL          | NULL | NULL    | NULL | NULL | No matching min/max row |
      +------+-------------+-------+------+---------------+------+---------+------+------+-------------------------+
      

      Attachments

        Issue Links

          Activity

            People

              psergei Sergei Petrunia
              psergei Sergei Petrunia
              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.