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

explain output difference in filtered column

    XMLWordPrintable

Details

    • Can result in unexpected behaviour
    • Q2/2026 Server Development

    Description

      Issue seen in main.statistics_json

      Trace output:

      ------------------------
      Capture : trace1.txt
      replay : trace2.txt

      Explain:

      ------------------

       explain extended select * from t1_bin where a between 'a-3a' and 'zzzzzzzzz';
       id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
      -1	SIMPLE	t1_bin	ALL	NULL	NULL	NULL	NULL	10	58.82	Using where
      +1	SIMPLE	t1_bin	ALL	NULL	NULL	NULL	NULL	10	10.00	Using where
      

      How to repro:

      set optimizer_record_context=ON;
       
      create table ten(a int primary key);
      insert into ten values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
      set histogram_size=100;
      set histogram_type='double_prec_hb';
      create table t1_bin (a varchar(255));
      insert into t1_bin select concat('a-', a) from ten;
      analyze table t1_bin persistent for all;
      select hex(histogram) from mysql.column_stats where table_name='t1_bin';
       
      explain extended select * from t1_bin where a between 'a-3a' and 'zzzzzzzzz';
      SELECT context INTO DUMPFILE 'context1.txt' FROM INFORMATION_SCHEMA.OPTIMIZER_CONTEXT;
      source /home/ppandith/test2/bld/data2/m8/context1.txt
      

      Attachments

        Issue Links

          Activity

            People

              bsrikanth Srikanth Bondalapati
              mariadb-pavithrapandith Pavithra Pandith
              Votes:
              0 Vote for this issue
              Watchers:
              1 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.