Bug #36474 Falcon reports unrealistic row estimate on simple key lookup
Submitted: 2 May 2008 14:13 Modified: 26 May 2010 17:49
Reporter: Philip Stoev Email Updates:
Status: Unsupported Impact on me:
None 
Category:MySQL Server: Falcon storage engine Severity:S3 (Non-critical)
Version:6.0.5 OS:Any
Assigned to: Ann Harrison CPU Architecture:Any
Tags: F_HANDLER, Optimizer, performance

[2 May 2008 14:13] Philip Stoev
Description:
After a relatively small set of INSERTS, falcon row estimate turns ot to be very unrealistic - Falcon reports 10% of the rows would match, whereas in reality only one row, or 0.1% of all rows would match.

This is bound to cause bad optimizer decisions. Innodb consistently reports a correct estimate.

How to repeat:
Load the attached sql script, and execute:

mysql> select count(*) from t2;
+----------+
| count(*) |
+----------+
|     1199 |
+----------+

mysql> explain select t2.fld3 from t2 where fld3 = 'honeysuckle';
+----+-------------+-------+------+---------------+------+---------+-------+------+-------------+
| id | select_type | table | type | possible_keys | key  | key_len | ref   | rows | Extra       |
+----+-------------+-------+------+---------------+------+---------+-------+------+-------------+
|  1 | SIMPLE      | t2    | ref  | fld3          | fld3 | 30      | const |  119 | Using where |
+----+-------------+-------+------+---------------+------+---------+-------+------+-------------+

mysql> optimize table t2;
+---------+----------+----------+----------+
| Table   | Op       | Msg_type | Msg_text |
+---------+----------+----------+----------+
| test.t2 | optimize | status   | OK       |
+---------+----------+----------+----------+
1 row in set (0.03 sec)

mysql> explain select t2.fld3 from t2 where fld3 = 'honeysuckle';
+----+-------------+-------+------+---------------+------+---------+-------+------+-------------+
| id | select_type | table | type | possible_keys | key  | key_len | ref   | rows | Extra       |
+----+-------------+-------+------+---------------+------+---------+-------+------+-------------+
|  1 | SIMPLE      | t2    | ref  | fld3          | fld3 | 30      | const |    2 | Using where |
+----+-------------+-------+------+---------------+------+---------+-------+------+-------------+
1 row in set (0.00 sec)

Suggested fix:
Make the row estimation figure consistent with reality.
[2 May 2008 14:14] Philip Stoev
SQL dump for bug 36474

Attachment: bug36474.sql (text/plain), 89.20 KiB.

[5 May 2008 18:41] Kevin Lewis
Related Worklog is #4395