[MDEV-7115] ANALYZE SELECT FROM empty table produces a plan which looks different from EXPLAIN Created: 2014-11-14  Updated: 2023-04-27

Status: Open
Project: MariaDB Server
Component/s: Optimizer
Affects Version/s: 10.1.0
Fix Version/s: 10.4, 10.5

Type: Bug Priority: Minor
Reporter: Elena Stepanova Assignee: Sergei Petrunia
Resolution: Unresolved Votes: 0
Labels: analyze-stmt

Issue Links:
Relates
relates to MDEV-406 ANALYZE $stmt Closed
relates to MDEV-6422 More testing for ANALYZE stmt and JSON Closed

 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.


Generated at Thu Feb 08 07:17:06 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.