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

Failed to match the stats from replay context with the optimizer stats:

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • None
    • 13.0
    • None
    • None

    Description

      Issue seen in heap.heap_hash

      Issue:

      --------
      Below warning thrown at replay:

      Warning | 4254 | Failed to match the stats from replay context with the optimizer stats: m8.t1.btn doesn't exist in list of range contexts

      How to repro

      set optimizer_record_context=ON;
      create table t1 (btn char(10) not null, key using HASH (btn)) engine=heap;
      insert into t1 values ("hello"),("hello"),("hello"),("hello"),("hello"),("a"),("b"),("c"),("d"),("e"),("f"),("g"),("h"),("i");
      alter table t1 add column new_col char(1) not null, add key using HASH (btn,new_col), drop key btn;
      update t1 set new_col=left(btn,1);
      explain select * from t1 where btn="a";
      SELECT context INTO DUMPFILE 'context1.txt' FROM INFORMATION_SCHEMA.OPTIMIZER_CONTEXT;
      source /home/ppandith/test2/bld/data2/m8/context1.txt
      

      First EXPLAIN:

      +------+-------------+-------+------+---------------+------+---------+------+------+-------------+
      | id   | select_type | table | type | possible_keys | key  | key_len | ref  | rows | Extra       |
      +------+-------------+-------+------+---------------+------+---------+------+------+-------------+
      |    1 | SIMPLE      | t1    | ALL  | btn           | NULL | NULL    | NULL | 14   | Using where |
      +------+-------------+-------+------+---------------+------+---------+------+------+-------------+
      

      Replay

      +------+-------------+-------+------+---------------+------+---------+------+------+-------------+
      | id   | select_type | table | type | possible_keys | key  | key_len | ref  | rows | Extra       |
      +------+-------------+-------+------+---------------+------+---------+------+------+-------------+
      |    1 | SIMPLE      | t1    | ALL  | btn           | NULL | NULL    | NULL | 14   | Using where |
      +------+-------------+-------+------+---------------+------+---------+------+------+-------------+
      1 row in set, 1 warning (0.001 sec)
       
      MariaDB [m8]> show warnings;
      +---------+------+---------------------------------------------------------------------------------------------------------------------------+
      | Level   | Code | Message                                                                                                                   |
      +---------+------+---------------------------------------------------------------------------------------------------------------------------+
      | Warning | 4254 | Failed to match the stats from replay context with the optimizer stats: m8.t1.btn doesn't exist in list of range contexts |
      +---------+------+---------------------------------------------------------------------------------------------------------------------------+
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              mariadb-pavithrapandith Pavithra Pandith
              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.