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

ANALYZE SELECT FROM empty table produces a plan which looks different from EXPLAIN

    XMLWordPrintable

    Details

      Description

      MariaDB [test]> create table t1 (a int, b int) engine=MyISAM;
      Query OK, 0 rows affected (0.24 sec)
       
      MariaDB [test]> explain select * from t1;
      +------+-------------+-------+--------+---------------+------+---------+------+------+---------------------+
      | id   | select_type | table | type   | possible_keys | key  | key_len | ref  | rows | Extra               |
      +------+-------------+-------+--------+---------------+------+---------+------+------+---------------------+
      |    1 | SIMPLE      | t1    | system | NULL          | NULL | NULL    | NULL |    0 | const row not found |
      +------+-------------+-------+--------+---------------+------+---------+------+------+---------------------+
      1 row in set (0.00 sec)
       
      MariaDB [test]> analyze select * from t1;
      +------+-------------+-------+------+---------------+------+---------+------+------+--------+----------+------------+--------------------------------+
      | id   | select_type | table | type | possible_keys | key  | key_len | ref  | rows | r_rows | filtered | r_filtered | Extra                          |
      +------+-------------+-------+------+---------------+------+---------+------+------+--------+----------+------------+--------------------------------+
      |    1 | SIMPLE      | NULL  | NULL | NULL          | NULL | NULL    | NULL | NULL |   NULL |     NULL |       NULL | no matching row in const table |
      +------+-------------+-------+------+---------------+------+---------+------+------+--------+----------+------------+--------------------------------+
      1 row in set (0.01 sec)

      Not that it's critically important, but since we discussed that the plans should be identical, I'm filing it. Besides, it's strange that the table name cannot be found in the plan.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              psergey Sergei Petrunia
              Reporter:
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated: