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

Explain output difference in rows column

    XMLWordPrintable

Details

    • Q2/2026 Server Development

    Description

      Issue seen in main.delete

      Trace output:

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

      Capture Explain :

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

      +------+-------------+-------+------+---------------+------+---------+------+------+-------------------+
      | id   | select_type | table | type | possible_keys | key  | key_len | ref  | rows | Extra             |
      +------+-------------+-------+------+---------------+------+---------+------+------+-------------------+
      |    1 | SIMPLE      | NULL  | NULL | NULL          | NULL | NULL    | NULL | 8    | Deleting all rows |
      +------+-------------+-------+------+---------------+------+---------+------+------+-------------------+
      

      Replay explain:

      +------+-------------+-------+------+---------------+------+---------+------+------+-------------------+
      | id   | select_type | table | type | possible_keys | key  | key_len | ref  | rows | Extra             |
      +------+-------------+-------+------+---------------+------+---------+------+------+-------------------+
      |    1 | SIMPLE      | NULL  | NULL | NULL          | NULL | NULL    | NULL | 1    | Deleting all rows |
      +------+-------------+-------+------+---------------+------+---------+------+------+-------------------+
      

      How to repro:

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

      set optimizer_record_context=ON;
       
      create table t1 (c1 integer, c2 integer, c3 integer);
      insert into t1 values
        (1,1,1), (1,2,2), (1,3,3), (2,1,4), (2,2,5), (2,3,6), (2,4,7), (2,5,8);
      create temporary table t select * from t1;
       
      explain delete from t1 order by c2;
      SELECT context INTO DUMPFILE 'context1.txt' FROM INFORMATION_SCHEMA.OPTIMIZER_CONTEXT;
      source context1.txt
      

      Attachments

        1. trace1.txt
          0.2 kB
          Pavithra Pandith
        2. trace2.txt
          0.2 kB
          Pavithra Pandith

        Issue Links

          Activity

            People

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