Details
-
Bug
-
Status: Closed (View Workflow)
-
Minor
-
Resolution: Fixed
-
None
-
None
-
None
Description
If I load mysql-test/include/world{_schema,}.inc and run the following query:
MariaDB [world]> explain select * from (select * from Country order by Population ASC limit 10) as small_country ;
---------------------------------------------------------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
---------------------------------------------------------------------------+
| 1 | PRIMARY | <derived2> | ALL | NULL | NULL | NULL | NULL | 239 | Â |
| 2 | DERIVED | Country | ALL | NULL | NULL | NULL | NULL | 239 | Using filesort |
---------------------------------------------------------------------------+
2 rows in set (0.00 sec)
I get 239 as the number of rows which will be scanned in table <derived2>.
This estimate is wrong, it should be easy to figure that "LIMIT 10" caps table
size to 10 rows.